httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <>
Subject [rant] os/cannonical error
Date Wed, 20 Sep 2000 18:40:10 GMT
The last post just reminded me...

MUST we be adding cpu cycles to flip OS errors to native ERRNO
values in canonerr.c!?!  I'm looking forward to the day we have
a 500 condition-long switch block.  -not-.

I've suggested a very long time ago... let's take the EAGAIN
error just for kicks.  Why not a simple, compile-time macro to
deal with this.  Unix:

#define APR_IS_EAGAIN(e) ((e) == APR_EAGAIN)

Gee.  No CPU cycles wasted.  Windows?

#define APR_IS_EAGAIN(e) (((e) == APR_EAGAIN) || (e) == WSAEWOULDBLOCK)

Ohhh... a whole extra few cycles.  Not an entire switch block full
of them, however.

If we realize a new API specific error on any platform... just add it
to the (now growing) list of equivilant errors.  Keep APR's list rather
short and sweet, and track the dozens of 'equivilant' errors using
the macro.  Very readable, I think...

    if (stat != APR_SUCCESS && 
        !(APR_IS_EINPROGRESS(stat) ||
            APR_IS_EAGAIN(stat))) {
        fprintf(stderr, "Could not connect: %s (%d)\n", 
		apr_strerror(stat, msgbuf, sizeof(msgbuf)), stat);

I don't think this is all that ungodly... but a 500 error case statement
will be, someday in the (near?) future.

View raw message