apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@xbc.nu>
Subject Re: Removing APR_STATUS_IS_SUCCESS macro
Date Sat, 11 May 2002 07:10:39 GMT
Karl Fogel wrote:

>Justin Erenkrantz <jerenkrantz@apache.org> writes:
>  
>
>>Due to some recent confusion with SVN and APR_STATUS_IS_SUCCESS,
>>I'd like to consider removing this macro and just forcing
>>everyone to do either a non-zero check or checking against the
>>APR_SUCCESS value (which isn't strictly needed because APR_SUCCESS
>>will always be 0, but that's fine with me).
>>
>>Thoughts?  I know most of our code in APR and httpd-2.0 is
>>pretty good about not using APR_STATUS_IS_SUCCESS.   -- justin
>>    
>>
>
>+1 if they always mean the same thing, but I'd like to first know the
>answer to this question:
>
>If APR_SUCCESS is absolutely and always defined to be zero, then why
>does apr_errno.h define the APR_STATUS_IS_SUCCESS() macro like this
>under WIN32
>
>  #define APR_STATUS_IS_SUCCESS(s)           ((s) == APR_SUCCESS \
>                  || (s) == APR_OS_START_SYSERR + ERROR_SUCCESS)
>
>and like this under OS2:
>
>  #define APR_STATUS_IS_SUCCESS(s)           ((s) == APR_SUCCESS \
>                  || (s) == APR_OS_START_SYSERR + NO_ERROR)
>
>
>That looks a bit more complex than just "== 0" to me... ?
>
ERROR_SUCCESS and NO_ERROR are always 0. If you look at the 
APR_TO_OS_ERROR and APR_FROM_OS_ERROR marcos, you'll see that they 
_always_ get mapped to/from APR_SUCCES.

So these extra checks are actually bogus, evil, and non-tax-deductible.

(And the APR_FROM/TO_OS_ERROR macros are wrong, too; they should read:

#define APR_FROM_OS_ERROR(e) ((e) == ERROR_SUCCESS ? APR_SUCCESS : (e) + APR_OS_START_SYSERR)
#define APR_TO_OS_ERROR(e)   ((e) == APR_SUCCESS ? ERROR_SUCCESS : (e) - APR_OS_START_SYSERR)

)



-- 
Brane ─îibej   <brane@xbc.nu>   http://www.xbc.nu/brane/



Mime
View raw message