MCPcopy Create free account
hub / github.com/NetHack/NetHack / init_nhfile

Function init_nhfile

src/files.c:460–490  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

458#define IS_BIGENDIAN() ( (*(char*)&bei) == 0 )
459
460void
461init_nhfile(NHFILE *nhfp)
462{
463 if (nhfp->structlevel) {
464 if (nhfp->fd != -1) {
465 impossible("Warning - Unclosed structlevel file being reinitialized");
466 (void) nhclose(nhfp->fd);
467 }
468 } else if (nhfp->fpdef) {
469 if (nhfp->fpdef) {
470 impossible("Warning - Unclosed fieldlevel file being reinitialized");
471 (void) fclose(nhfp->fpdef);
472 }
473 }
474 nhfp->fd = -1;
475 nhfp->fpdef = (FILE *) 0;
476
477 nhfp->mode = COUNTING;
478 nhfp->structlevel = TRUE;
479 nhfp->fieldlevel = FALSE;
480 nhfp->addinfo = FALSE;
481 nhfp->bendian = IS_BIGENDIAN();
482 nhfp->fplog = (FILE *) 0;
483 nhfp->fpdebug = (FILE *) 0;
484 nhfp->rcount = nhfp->wcount = 0;
485 nhfp->eof = FALSE;
486 nhfp->fnidx = 0;
487 nhfp->style.deflt = FALSE;
488 nhfp->style.binary = TRUE;
489 nhfp->nhfpconvert = 0;
490}
491
492#ifndef SFCTOOL
493staticfn

Callers 2

new_nhfileFunction · 0.85
free_nhfileFunction · 0.85

Calls 3

nhcloseFunction · 0.85
fcloseFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected