This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add STATIC_GETENV macro.
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>, libc-alpha at sourceware dot org
- Date: Sun, 10 Nov 2013 02:52:21 -0500
- Subject: Re: [PATCH] Add STATIC_GETENV macro.
- Authentication-results: sourceware.org; auth=none
- References: <20131109103822 dot GA9173 at domone>
On 11/09/2013 05:38 AM, OndÅej BÃlka wrote:
> Hi,
>
> This adds a STATIC_GETENV macro for avoiding possible getenv bottlenecks as
> documented in 'Make getenv O(1)' thread.
>
> As this is useful addition this could be a gnu extension.
>
> An patch that converts internal getenv uses to STATIC_GETENV will
> follow.
>
> There is question if we should make STATIC_GETENV call a secure_getenv
> by default or add STATIC_SECURE_GETENV.
>
> This depends on if getenv calls in next patch could be replaced by
> secure getenv or not.
>
> So far both choices are possible.
>
> * stdlib/stdlib.h (STATIC_GETENV): Add.
> * manual/startup.texi (Environment Access): Document STATIC_GETENV.
> * NEWS: Mention STATIC_GETENV.
I like where this is going, but new functions like this will need
quite a bit of discussion, and it isn't clear to me what uses users
would use this where they wouldn't just cache the value themselves?
One of the goals here is that we don't turn this into a "everything
and the kitchen sink" library.
Unless there is a strong argument for a new function I'm against
adding a public API for anything the user can do easily themselves.
Cheers,
Carlos.