[Zlib-devel] [PATCH] Avoid inclusion of unistd.h in all source files

Xin LI delphij at gmail.com
Sun Apr 4 18:31:00 EDT 2010


On Sat, Apr 3, 2010 at 10:12 PM, Mark Adler <madler at alumni.caltech.edu> wrote:
> On Mar 29, 2010, at 1:22 PM, Xin LI wrote:
>> Could we do this instead, perhaps, when _STANDALONE (means
>> freestanding environment, e.g. boot loader where unistd.h needs to be
>> avoided) is defined, don't include unistd.h?
>
> Actually on my to-do list is a define to avoid *all* #includes of libraries in order to build a zlib for embedded applications.  It would remove all the gz* functions and would require the user to provide memory allocation routines.  Would that meet your needs?

Yes, that would be helpful.

Currently we (FreeBSD) patch source code by replacing unistd.h, etc.
with the freestanding header at build time.  With a build time option
of excluding the normal system headers, we will still need to add
prototypes or inclusion of the header, though, as lacking of prototype
would cause problem when the default prototype does not match,
especially on 64bit platforms.

Cheers,
-- 
Xin LI <delphij at delphij.net> http://www.delphij.net




More information about the Zlib-devel mailing list