Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Oct 1995 21:52:15 -0700
From:      David Greenman <davidg@Root.COM>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        CVS-commiters@freefall.freebsd.org, cvs-lib@freefall.freebsd.org
Subject:   Re: cvs commit: src/lib/libc/stdlib getenv.c 
Message-ID:  <199510180452.VAA29068@corbin.Root.COM>
In-Reply-To: Your message of "Wed, 18 Oct 95 14:41:56 %2B1000." <199510180441.OAA10353@godzilla.zeta.org.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
>>  Modified:    lib/libc/stdlib  getenv.c
>>  Log:
>>  Doubled the performance of getenv()/__findenv() by rewriting it to not
>>  use strncmp()..
>
>The __findenv() wart is now duplicated.  It is inlined in getenv() and
>exported for use by only (?) setenv().  It should be `static inline'
>in a private header file and inlined by both (if it is worth inlining
>at all).

   I'm aware of that and it was quite intentional. getenv() is called often,
setenv() is rarely called. There is no reason to inline __findenv() for
setenv() and unsetenv(), and inlining it for all three cases would just
create yet one more copy. It was cheap to inline it for getenv() since it
only required moving it within the file. If we are going to "fix" this, the
only thing I would accept would be to make getenv() completely self contained
(__findenv() does more than getenv() needs), and move __findenv() into
setenv.c and then make it static.

-DG



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199510180452.VAA29068>