Geoffrey Young wrote:
hi again

the below patch moves the guts of mpxs_Apache__Module_get_config to a new public function, modperl_get_config, and leaves mpxs_Apache__Module_get_config as a wrapper.

a project I'm tinkering with now requires the config object from within XS, but currently I need to copy most of the code from mpxs_Apache__Module_get_config into my XS due to the hidden nature of the function. modperl_module_config_get_obj doesn't fit the bill either, since it requires lots of stuff not available outside of the config environment.

the new function would be used like this

  SV *obj = modperl_get_config(aTHX_ newSVpvn("My::Foo", 7),
                               r->server, r->per_dir_config);

anyway, I figured that making the object-fetching routine publically available would benefit XS developers (ok, who am I kidding - nobody cares about this stuff but me :).

anyway... objections, thoughts, comments?

I think the concept is fine. However a few issue with the patch:


- if your wrapper calls directly the function, without doing anything else, but dropping "self" you should use DEFINE_, just in case compiler doesn't inline that call. I don't remember if it's in the doc.

- I don't think modperl_get_config is a good choice for a function name. It must start with modperl_module_ (think of namespaces, ala C++). How about modperl_module_config_get? Probably need to add comments explaining the difference between this and get_config_obj functions.

- Also I'm not sure about keeping the SvREFCNT_inc(obj) part. It's needed when returning an SV that goes into perl domain, but it's probably not a good choice for C API.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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



Reply via email to