MCPcopy Index your code
hub / github.com/NetHack/NetHack / bclose

Function bclose

src/sfstruct.c:446–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444}
445
446void
447bclose(int fd)
448{
449 int idx = getidx(fd, NOSLOT);
450
451 bufoff(fd); /* sets bw_buffered[idx] = 0 */
452 if (idx >= 0) {
453#ifdef USE_BUFFERING
454 if (bw_FILE[idx]) {
455 (void) fclose(bw_FILE[idx]);
456 bw_FILE[idx] = 0;
457 } else
458#endif
459 close(fd);
460 /* return the idx to the pool */
461 bw_sticky[idx] = -1;
462 }
463#ifdef SFLOGGING
464 if (fd >= 0 && fd <= SIZE(ofp)) {
465 if (ofp[fd]) {
466 fclose(ofp[fd]);
467 ofp[fd] = 0;
468 } else if (ifp[fd]) {
469 fclose(ifp[fd]);
470 ifp[fd] = 0;
471 }
472 }
473#endif
474 return;
475}
476
477void
478bflush(int fd)

Callers 1

nhcloseFunction · 0.85

Calls 4

getidxFunction · 0.85
bufoffFunction · 0.85
fcloseFunction · 0.85
closeFunction · 0.85

Tested by

no test coverage detected