apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: enum and defines naming
Date Thu, 27 May 2004 23:11:08 GMT
Anybody?

Stas Bekman wrote:
> William A. Rowe, Jr. wrote:
> 
>> At 08:02 PM 5/21/2004, Stas Bekman wrote:
>>
>>> Before apr 1.0 is cast in stone any chance public enums and defines will
>>> get sensible names? It all looks nice in the declaration but in the 
>>> code,
>>> one needs to scratch the head to figure out what APR_REG means. Why not
>>> have /^APR_FILETYPE_/ prefix? APR_FILETYPE_REG requires no head
>>> scratching when reading the code and won't collide with some other enum
>>> with a totally different functionality.
>>
>>
>>
>> +1
>>
>>
>>> Same goes for defines, for example: There are all related to files, why
>>> pollute the namespace with such short names and not fix them to have a
>>> sensible prefix similar to above suggestion? /^APR_FILETYPE_/ as in
>>> APR_FILETYPE_UREAD.
>>
>>
>>
>>
>> +1 again.  This is why 1.0 isn''t ready just yet, IMHO :)
> 
> 
> Thanks. So what's the next step? How one performs this kind of rename? I 
> have seen that done with functions, not sure how does it work for enums. 
> I guess defines are the same as functions.
> 
> Should it be s/APR_/APR_FILETYPE_/ and s/APR_/APR_FINFO_/ or something 
> else? Like so?
> 
> typedef enum {
>     APR_FILETYPE_NOFILE = 0,     /**< no file type determined */
>     APR_FILETYPE_REG,            /**< a regular file */
>     APR_FILETYPE_DIR,            /**< a directory */
>     APR_FILETYPE_CHR,            /**< a character device */
>     APR_FILETYPE_BLK,            /**< a block device */
>     APR_FILETYPE_PIPE,           /**< a FIFO / pipe */
>     APR_FILETYPE_LNK,            /**< a symbolic link */
>     APR_FILETYPE_SOCK,           /**< a [unix domain] socket */
>     APR_FILETYPE_UNKFILE = 127   /**< a file of some other unknown type */
> } apr_filetype_e;
> 
> 
> 
> #define APR_FINFO_UREAD       0x0400 /**< Read by user */
> #define APR_FINFO_UWRITE      0x0200 /**< Write by user */
> #define APR_FINFO_UEXECUTE    0x0100 /**< Execute by user */
> 
> #define APR_FINFO_GREAD       0x0040 /**< Read by group */
> #define APR_FINFO_GWRITE      0x0020 /**< Write by group */
> #define APR_FINFO_GEXECUTE    0x0010 /**< Execute by group */
> 
> #define APR_FINFO_WREAD       0x0004 /**< Read by others */
> #define APR_FINFO_WWRITE      0x0002 /**< Write by others */
> #define APR_FINFO_WEXECUTE    0x0001 /**< Execute by others */
> 
> 


-- 
__________________________________________________________________
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