httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [apreq-2] libapreq_cgi and getenv
Date Mon, 20 Oct 2003 07:07:11 GMT
Randy Kobes wrote:
> On Sun, 19 Oct 2003, Stas Bekman wrote:
> 
> 
>>Randy Kobes wrote:
>>
>>
>>>>it doesn't hurt to check for failure. Probabaly write a macro to avoid noise
>>>>(adopted from mp2):
>>>>
>>>>+ #define APREQ_ASSERT(rc_run) do { \
>>>>+         apr_status_t rc = rc_run; \
>>>>+         if (rc != APR_SUCCESS) { \
>>>>+             ap_log_error(APLOG_MARK, APLOG_ERR, rc, NULL, "failed: "); \
>>>>+         } \
>>>>+     } while (0)
>>
>>[...]
>>
>>>Thanks, Stas! That is a good check ...
>>
>>well, ideally it should abort the execution as well...
>>
>>Also may be APREQ_ASSERT is not the best name, in mp2 it's called
>>MP_FAILURE_CROAK()... may be APREQ_STATUS_CHECK? or something like that?
> 
> 
> Perhaps APREQ_STATUS_CHECK?

Sounds fine, the shorter the better. APREQ_STATCHK, probably hard to spel. 
APREQ_CHECK? APREQ_IS_OK? APREQ_OK?

> I'm not sure it should abort, though, at least for
> apr_get_env(); from what I gather, if the environment
> variable for a given key doesn't exist, it just returns
> that key (and sets the status accordingly), and it's up to
> the caller to deal with that case?

Note that we don't abort when the key is not returned, but when the status is 
not APR_SUCCESS, which means that something went wrong, and not when the 
variable is not set. I was suggesting this as a macro that can be used 
everywhere in apreq C source files.


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


Mime
View raw message