[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apache-httpd-dev
Subject:    Re: cvs commit: httpd-2.0/modules/generators mod_cgid.c
From:       Ben Laurie <ben () algroup ! co ! uk>
Date:       2000-12-31 16:20:57
[Download RAW message or body]

Greg Stein wrote:
> 
> On Wed, Dec 13, 2000 at 01:30:40PM -0000, trawick@locus.apache.org wrote:
> > trawick     00/12/13 05:30:40
> >
> >   Modified:    .        CHANGES
> >                modules/generators mod_cgid.c
> >   Log:
> >   Straighten up the first-time-through check in mod_cgid and add a CHANGES
> >   entry for the bug fixes to mod_rewrite and mod_cgid.
> >...
> >   --- mod_cgid.c      2000/12/13 04:03:19     1.53
> >   +++ mod_cgid.c      2000/12/13 13:30:40     1.54
> >   @@ -515,9 +515,17 @@
> >        pid_t pid;
> >        apr_proc_t *procnew;
> >        void *data;
> >   +    int first_time = 0;
> >   +    const char *userdata_key = "cgid_init";
> >
> >   -    apr_get_userdata(&data, "cgid_init", main_server->process->pool);
> >   -    if (data != NULL) {
> >   +    apr_get_userdata(&data, userdata_key, main_server->process->pool);
> 
> Why a local variable for this stuff? That seems a bit weird... sort of gives
> the impression that something might change it.
> 
> If you're attempting to avoid a typo, then use a #define CGID_INIT; the
> compiler will then catch typos, and the #define gives you a single place to
> change if you want to alter the string.
> 
> (I use the #define technique in mod_dav for the user_data)

Isn't the right thing to create a (global) constant?

static const char userdata_key[]="cgid_init";

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic