On Mon, Jun 11, 2001 at 03:32:22PM -0700, Ian Holsman wrote:
> > -----Original Message-----
> > From: William A. Rowe, Jr. [mailto:[EMAIL PROTECTED]]
>...
> > data, and that will not be heavily string intensive, so we
> > won't laden the server
> > with unnecessary cpu. Yes?
>
> I was thinking that there would be a 'description' and a 'module' field with
> each number which would describe what the value represents.
> the 'scoreboard.requests.total' key would have a description 'The Total # of
>requests served since
> apache was started' and a module 'scoreboard'. which would be apr_pstrdup'ed in.
There is absolutely no need to strdup those strings. They are constant
strings that survive forever. It is silly to copy them to the heap. Just
say:
item = apr_pcalloc(p, sizeof(*item));
item->description = "Combat boot size";
item->name = "mom.feet.boot-size";
...
Just make sure to change the description/module to "const char *", and you
should be set. The string value (in the union type) should be const-ified,
too.
I would also recommend changing "module" to "name". Each item can specify
its name, rather than just the defining module. (and if we use a dotted name
as the precedent, then "module" can also be extracted)
Cheers,
-g
--
Greg Stein, http://www.lyra.org/