annotate zlib/gzclose.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* gzclose.c -- zlib gzclose() function
kono
parents:
diff changeset
2 * Copyright (C) 2004, 2010 Mark Adler
kono
parents:
diff changeset
3 * For conditions of distribution and use, see copyright notice in zlib.h
kono
parents:
diff changeset
4 */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 #include "gzguts.h"
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 /* gzclose() is in a separate file so that it is linked in only if it is used.
kono
parents:
diff changeset
9 That way the other gzclose functions can be used instead to avoid linking in
kono
parents:
diff changeset
10 unneeded compression or decompression routines. */
kono
parents:
diff changeset
11 int ZEXPORT gzclose(file)
kono
parents:
diff changeset
12 gzFile file;
kono
parents:
diff changeset
13 {
kono
parents:
diff changeset
14 #ifndef NO_GZCOMPRESS
kono
parents:
diff changeset
15 gz_statep state;
kono
parents:
diff changeset
16
kono
parents:
diff changeset
17 if (file == NULL)
kono
parents:
diff changeset
18 return Z_STREAM_ERROR;
kono
parents:
diff changeset
19 state = (gz_statep)file;
kono
parents:
diff changeset
20
kono
parents:
diff changeset
21 return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
kono
parents:
diff changeset
22 #else
kono
parents:
diff changeset
23 return gzclose_r(file);
kono
parents:
diff changeset
24 #endif
kono
parents:
diff changeset
25 }