map_uid_to_username() proposal

Natanael Copa natanael.copa at gmail.com
Thu Apr 20 22:05:38 UTC 2006


On Thu, 20 Apr 2006 16:50:14 -0400 (EDT)
"Robert P. J. Day" <rpjday at mindspring.com> wrote:

> hang on, let me clarify something here.  the reason that function is a
> little complicated is that it's designed to avoid any possible memory
> leak, no matter how many times it's called, so if you *want* that
> feature, you obviously have to pay for it with a little more size.

What wrong with static buffers? (sure, you cannot use them with threads... but this is busybox)

I like the:

if (str = strcpy(func_that_returns_static_buf())) {
  /* use str */
  free(str);
}

Its fast, its small, its convenient to use.

-- 
Natanael Copa



More information about the busybox mailing list