MCPcopy Create free account
hub / github.com/F-Stack/f-stack / gzclose_r

Function gzclose_r

freebsd/contrib/zstd/zlibWrapper/gzread.c:651–678  ·  view source on GitHub ↗

-- see zlib.h -- */

(file)

Source from the content-addressed store, hash-verified

649
650/* -- see zlib.h -- */
651int ZEXPORT gzclose_r(file)
652 gzFile file;
653{
654 int ret, err;
655 gz_statep state;
656
657 /* get internal structure */
658 if (file == NULL)
659 return Z_STREAM_ERROR;
660 state.file = file;
661
662 /* check that we're reading */
663 if (state.state->mode != GZ_READ)
664 return Z_STREAM_ERROR;
665
666 /* free memory and close file */
667 if (state.state->size) {
668 inflateEnd(&(state.state->strm));
669 free(state.state->out);
670 free(state.state->in);
671 }
672 err = state.state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK;
673 gz_error(state, Z_OK, NULL);
674 free(state.state->path);
675 ret = close(state.state->fd);
676 free(state.state);
677 return ret ? Z_ERRNO : err;
678}

Callers 1

gzcloseFunction · 0.70

Calls 3

gz_errorFunction · 0.70
freeFunction · 0.50
closeFunction · 0.50

Tested by

no test coverage detected