Put gzflags() functionality back in zutil.c.

gzflags() was put in gzwrite.c in order to be compiled exactly the
same as gzprintf(), so that it was guaranteed to return the correct
information.  However that causes a static linkage to zlib to bring
in many routines that are often not used.  All that is required to
duplicate the compilation environment of gzprintf() is to include
gzguts.h.  So that is now done in zutil.c to assure that the correct
flags are returned.
This commit is contained in:
Mark Adler 2012-02-01 23:25:34 -08:00
parent a8d23bb675
commit 55b8b5fec1
12 changed files with 26 additions and 47 deletions

View File

@ -195,7 +195,6 @@ STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('ZLIB')
/********************************************************************/
EXPORT SYMBOL("gzgetc_")
EXPORT SYMBOL("gzflags")
/********************************************************************/
/* *MODULE INFLATE ZLIB 01/02/01 00:15:09 */

View File

@ -442,6 +442,4 @@
D PR 10I 0 extproc('deflateResetKeep') End and init. stream
D strm like(z_stream) Expansion stream
*
D gzflags PR 10U 0 extproc('gzflags')
*
/endif

View File

@ -132,6 +132,5 @@ EXPORTS
; zlib1 v1.2.6 added:
gzgetc_ @161
gzflags @162
inflateResetKeep @163
deflateResetKeep @164

View File

@ -132,6 +132,5 @@ EXPORTS
; zlib1 v1.2.6 added:
gzgetc_ @161
gzflags @162
inflateResetKeep @163
deflateResetKeep @164

View File

@ -560,34 +560,3 @@ int ZEXPORT gzclose_w(file)
free(state);
return ret;
}
/* used by zlibVersion() to get the vsnprintf story from the horse's mouth */
unsigned long ZEXPORT gzflags()
{
unsigned long flags = 0;
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifdef NO_vsnprintf
flags += 1L << 25;
# ifdef HAS_vsprintf_void
flags += 1L << 26;
# endif
# else
# ifdef HAS_vsnprintf_void
flags += 1L << 26;
# endif
# endif
#else
flags += 1L << 24;
# ifdef NO_snprintf
flags += 1L << 25;
# ifdef HAS_sprintf_void
flags += 1L << 26;
# endif
# else
# ifdef HAS_snprintf_void
flags += 1L << 26;
# endif
# endif
#endif
return flags;
}

View File

@ -81,4 +81,3 @@ EXPORTS
inflateResetKeep
deflateResetKeep
gzgetc_
gzflags

View File

@ -65,7 +65,6 @@
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflags z_gzflags
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_

View File

@ -67,7 +67,6 @@
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflags z_gzflags
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_

View File

@ -65,7 +65,6 @@
# define gzdopen z_gzdopen
# define gzeof z_gzeof
# define gzerror z_gzerror
# define gzflags z_gzflags
# define gzflush z_gzflush
# define gzgetc z_gzgetc
# define gzgetc_ z_gzgetc_

3
zlib.h
View File

@ -1727,9 +1727,6 @@ ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void));
ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int));
ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp));
ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp));
#ifndef Z_SOLO
ZEXTERN unsigned long ZEXPORT gzflags OF((void));
#endif
#ifdef __cplusplus
}

View File

@ -73,7 +73,6 @@ ZLIB_1.2.5.1 {
ZLIB_1.2.5.2 {
deflateResetKeep;
gzflags;
gzgetc_;
inflateResetKeep;
} ZLIB_1.2.5.1;

29
zutil.c
View File

@ -6,6 +6,9 @@
/* @(#) $Id$ */
#include "zutil.h"
#ifndef Z_SOLO
# include "gzguts.h"
#endif
#ifndef NO_DUMMY_DECL
struct internal_state {int dummy;}; /* for buggy compilers */
@ -85,11 +88,31 @@ uLong ZEXPORT zlibCompileFlags()
#ifdef FASTEST
flags += 1L << 21;
#endif
#ifdef Z_SOLO
return flags;
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
# ifdef NO_vsnprintf
flags += 1L << 25;
# ifdef HAS_vsprintf_void
flags += 1L << 26;
# endif
# else
# ifdef HAS_vsnprintf_void
flags += 1L << 26;
# endif
# endif
#else
return flags + gzflags();
flags += 1L << 24;
# ifdef NO_snprintf
flags += 1L << 25;
# ifdef HAS_sprintf_void
flags += 1L << 26;
# endif
# else
# ifdef HAS_snprintf_void
flags += 1L << 26;
# endif
# endif
#endif
return flags;
}
#ifdef DEBUG