apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mihai Limbasan <mihai...@gmail.com>
Subject apr_status_t testing against APR_SUCCESS usage question
Date Mon, 27 Dec 2004 10:40:41 GMT
>From what I've gathered reviewing the APR code, the canonical way of
testing apr_* return values is comparing against APR_SUCCESS. That
happens to be #defined as zero.

There are a lot of places around the APR codebase that do stuff like this:

    if (rv)
        return rv;

i.e. taking advantage of the knowledge that APR_SUCCESS is zero and
returning (or taking some other action) based on a non-zero (hence
non-APR_SUCCESS) status.

This seems to defeat the point of having an APR_SUCCESS in the first
place. It's also (at least in my eyes) slightly less intuitive than
explicit testing.

Would it be useful if I went through the code and properly
canonicalized such constructs to

    if (rv != APR_SUCCESS) {
        return rv;


View raw message