apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Bloom" <...@covalent.net>
Subject RE: proposal to add apr_check_dir_empty() to APR
Date Tue, 02 Jul 2002 20:31:26 GMT
> From: Aaron Bannert [mailto:aaron@clove.org]
>
> On Tue, Jul 02, 2002 at 01:07:59PM -0700, Ryan Bloom wrote:
> > The return code should not be EGENERAL if the directory isn't empty.
> > Create a new status code if you have to, but a non-empty directory
is
> > not an error condition.
> 
> I agree. EGENERAL is not the polar opposite of SUCCESS. APR isn't
> really friendly with simple binary functions that want to return
errors.
> It seems like you just want to return true or false in the normal
case,
> but also have the option to return an error if something blows up.
> Adding another apr_status_t code would be ok.  Maybe APR_FAILURE to
> complement APR_SUCCESS, or we could go all out and add APR_TRUE
> and APR_FALSE...

No.  APR is incredibly friendly with simple binary functions that want
to return errors.  Take a look at apr_errno.h, we have a whole section
of return codes that do not imply success or failure, they are STATUS
codes.  In this case, add a new STATUS code for non-empty directory, and
then you can return APR_SUCCESS for empty, the new code for non-empty,
and an error value for an error.

Ryan



Mime
View raw message