clearenv for newlib

Eric Blake
Sat Sep 15 11:55:00 GMT 2007

Hash: SHA1

According to Ralf Corsepius on 9/14/2007 11:33 PM:
> On Fri, 2007-09-14 at 10:41 -0500, Joel Sherrill wrote:
>> Hi,
>> I am porting a library to RTEMS that is calling clearenv().
>> I am willing to implement one for newlib.
> Frankly speaking, I am opposed to letting clearenv() into newlib,
> because it is a non-standardized, non-documented function.

It is well documented, just not standardized yet; and it can be a whole
lot more efficient than repeated unsetenv() calls, not to mention that
without clearenv() you must walk environ, which POSIX discourages.  And I
am not opposed to adding it at ELIX level 4.  If you use static linking,
there is nothing wrong with additional functions in newlib, as long as
they are in their own .o file, because they do not bloat your executable
if you do not use them.  And in larger systems with shared libraries, such
as cygwin, the extra functions make newlib more useful, and can still be
filtered by using smaller ELIX levels.  For example, witness the recent
addition of funopen and fopencookie to newlib - neither function is
standardized (funopen comes from BSD and fopencookie from Linux), but
having them at ELIX level 4 makes it easier to port autogen to Cygwin.

- --
Don't work too hard, make some time for fun as well!

Eric Blake   
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


More information about the Newlib mailing list