Re: g_setenv g_unsetenv

On Thu, 7 Sep 2000, George wrote:

> Now the question is, how far should this be taken.  Do we want book keeping?
> Or do we just accept memleaks.  Note that bookkeeping will never be perfect
> if intermixed with normal setenv, putenv calls, and may be more expensive
> then the memleaks.

i think we can't really circumvent memleaks, i.e.
if glib does putenv("FOO=bar") and some other library portions
reads out FOO and keeps a pointer to "bar", considering the environment
static, things would go to hell if we reset FOO and freed the mem.
granted that'd probably not be the best programming style, but i think
we should account for such situations and just leak upon putenv() (need
to document this though, so people take care not to call it in a loop).
as for your version of g_putenv(), i don't think the override flag is
really necessary, after all g_getenv() is already there if people want
to preserve the old value, and in general we try to match libc compatibility
or portability functions as close as possible (though, i do think that
splitting "VAR=val" into "VAR" and "val" is a good idea).

> George


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]