Doug, what's the correct style for #define?

a)
#define foo \
bar...

or

b)
#define foo \
     bar...
^^^^

e.g. in modperl_config.c you have used both:


#define merge_item(item) \
mrg->item = add->item ? add->item : base->item

#define merge_handlers(merge_flag, array) \
     if (merge_flag(mrg)) { \
      ...

Personally I like (b) better (4 indent), as it's easier to tell the 
numerous defines from their bodies :)

Another question is placement of functions in Perl and C code. As the 
code gets developed new functions are many times added in the ad-hoc 
placement -- i.e. some functions spring next to the place they are 
needed, some function are prepended to the top, some go to the bottom. 
It's much easier to understand unfamiliar code if the functions are 
defined in some logical order.

Is it ok to reshuffle some of the functions and commit as I read the 
code? e.g. in modperl_config.c currently we have:

void *modperl_config_dir_create(apr_pool_t *p, char *dir)
void *modperl_config_dir_merge(apr_pool_t *p, void *basev, void *addv)
modperl_config_req_t *modperl_config_req_new(request_rec *r)
modperl_config_srv_t *modperl_config_srv_new(apr_pool_t *p)
modperl_config_dir_t *modperl_config_dir_new(apr_pool_t *p)
static void dump_argv(modperl_config_srv_t *scfg)
char **modperl_config_srv_argv_init(modperl_config_srv_t *scfg, int *argc)
void *modperl_config_srv_create(apr_pool_t *p, server_rec *s)
void *modperl_config_srv_merge(apr_pool_t *p, void *basev, void *addv)
int modperl_config_apply_PerlModule(server_rec *s,
int modperl_config_apply_PerlRequire(server_rec *s,

I'd rather see as:

modperl_config_srv_t *modperl_config_srv_new(apr_pool_t *p)
void *modperl_config_srv_create(apr_pool_t *p, server_rec *s)
void *modperl_config_srv_merge(apr_pool_t *p, void *basev, void *addv)
char **modperl_config_srv_argv_init(modperl_config_srv_t *scfg, int *argc)

modperl_config_dir_t *modperl_config_dir_new(apr_pool_t *p)
void *modperl_config_dir_create(apr_pool_t *p, char *dir)
void *modperl_config_dir_merge(apr_pool_t *p, void *basev, void *addv)

modperl_config_req_t *modperl_config_req_new(request_rec *r)

static void dump_argv(modperl_config_srv_t *scfg)
int modperl_config_apply_PerlModule(server_rec *s,
int modperl_config_apply_PerlRequire(server_rec *s,

or even better

modperl_config_srv_t *modperl_config_srv_new(apr_pool_t *p)
modperl_config_dir_t *modperl_config_dir_new(apr_pool_t *p)
modperl_config_req_t *modperl_config_req_new(request_rec *r)

void *modperl_config_srv_create(apr_pool_t *p, server_rec *s)
void *modperl_config_dir_create(apr_pool_t *p, char *dir)

void *modperl_config_srv_merge(apr_pool_t *p, void *basev, void *addv)
void *modperl_config_dir_merge(apr_pool_t *p, void *basev, void *addv)

char **modperl_config_srv_argv_init(modperl_config_srv_t *scfg, int *argc)

static void dump_argv(modperl_config_srv_t *scfg)
int modperl_config_apply_PerlModule(server_rec *s,
int modperl_config_apply_PerlRequire(server_rec *s,




_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to