[Zlib-devel] [PATCH] Move gzflags to zutil.c

Mark Adler madler at madler.net
Thu Feb 2 02:01:12 EST 2012


On Feb 1, 2012, at 12:27 AM, Xin LI wrote:
> I find it a little bit weird that gzflags() belongs to gzwrite.c.  Is there a reason behind this?

Yes.

gzflags() returns information about how gzprintf() was compiled.  gzprintf() is in gzwrite.c, so having gzflags() also in gzwrite.c assures that it is compiled under exactly the same macro definitions.  Hence the comment for gzflags():

/* used by zlibVersion() to get the vsnprintf story from the horse's mouth */

However as John points out, this forces one to link in a bunch of stuff that's often not needed.  Since all of the gzwrite.c macros are determined in gzguts.h, I will move the gzflags() functionality into zutil.c, and include gzguts.h to support that.

If I applied your patch which moves gzflags() but does not include gzguts.h, then that would give entirely the wrong result.

Mark





More information about the Zlib-devel mailing list