[Zlib-devel] [PATCH] use "zalloc_func" and "zfree_func" insteadof "alloc_func" and "free_func"

Lelegard Thierry Thierry.Lelegard at nagra.fr
Fri Feb 6 13:40:58 EST 2004


> From: Zlib-devel-bounces at zlib.net 
> [mailto:Zlib-devel-bounces at zlib.net]On
> Behalf Of Mark Adler

> > I think such name is not a good choice for a libarary, I think we'd
> > better change it to something like "zfree_func" and "zalloc_func".

> You are entirely correct.  That was a poor choice of names.  However 
> zlib is stuck with those names to maintain backward compatibility.

These names are typical candidates for Z_PREFIX transformation.

In zconf.h:
#ifdef Z_PREFIX
// skip ....
#  define Byte          z_Byte
// skip ....
#endif

In our applications, we always define Z_PREFIX to avoid this
type of name clash.

Unfortunately, this name domain transformation does not cover
all identifiers (either linker symbols or C identifiers) in Zlib.
I have noticed the following omissions:

alloc_func
free_func
internal_state
inflateBackInit_
inflateBackEnd
inflateBack
in_func
out_func

I consider that identifiers starting in "zlib" or "gz" do
not require such transformation.

I suggest to add the following inside the #ifdef Z_PREFIX / #endif:

#  define alloc_func        z_alloc_func
#  define free_func         z_free_func
#  define internal_state    z_internal_state
#  define inflateBackInit_  z_inflateBackInit_
#  define inflateBackEnd    z_inflateBackEnd
#  define inflateBack       z_inflateBack
#  define in_func           z_in_func
#  define out_func          z_out_func

-Thierry
_________________________________________________________________

Thierry Lelegard (thierry.lelegard at nagra.fr)
Nagra France, 34 place Raoul Dautry, 75738 Paris Cedex 15, France
Tel: +33 1 71 71 54 30   Fax: +33 1 71 71 52 08
_________________________________________________________________




More information about the Zlib-devel mailing list