2
0

gzclose.c 673 B

12345678910111213141516171819202122232425
  1. /* gzclose.c -- zlib gzclose() function
  2. * Copyright (C) 2004, 2010 Mark Adler
  3. * For conditions of distribution and use, see copyright notice in zlib.h
  4. */
  5. #include "gzguts.h"
  6. /* gzclose() is in a separate file so that it is linked in only if it is used.
  7. That way the other gzclose functions can be used instead to avoid linking in
  8. unneeded compression or decompression routines. */
  9. int ZEXPORT gzclose(
  10. gzFile file)
  11. {
  12. #ifndef NO_GZCOMPRESS
  13. gz_statep state;
  14. if (file == NULL)
  15. return Z_STREAM_ERROR;
  16. state = (gz_statep)file;
  17. return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
  18. #else
  19. return gzclose_r(file);
  20. #endif
  21. }