[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [Libvirt-announce] Release of libvirt-0.9.10



On 02/20/2012 03:15 AM, Daniel Veillard wrote:
> On Mon, Feb 20, 2012 at 09:59:23AM +0100, Jiri Denemark wrote:
>> On Mon, Feb 20, 2012 at 11:26:50 +0800, Daniel Veillard wrote:
>>> diff --git a/src/util/virfile.h b/src/util/virfile.h
>>> index ec1e90b..184677c 100644
>>> --- a/src/util/virfile.h
>>> +++ b/src/util/virfile.h
>>> @@ -58,10 +58,10 @@ typedef virFileWrapperFd *virFileWrapperFdPtr;
>>>  
>>>  int virFileDirectFdFlag(void);
>>>  
>>> -enum {
>>> +enum virFileWrapperFdFlags {
>>>      VIR_FILE_WRAPPER_BYPASS_CACHE   = (1 << 0),
>>>      VIR_FILE_WRAPPER_NON_BLOCKING   = (1 << 1),
>>> -} virFileWrapperFdFlags;
>>> +};
>>
>> Actually the error was missing typedef (again, shame on me) but this patch
>> fixes it as well and since we use these flags OR-ed, it's unlikely we will
>> ever need to use the type anywhere.
> 
>   Well let's make the typedef explicit, that's cleaner, ACK in advance
>   if you want to make that patch :-)

Is this enough of a preferred style that we should go ahead and add a
note in HACKING about the style preference, as well as add a syntax
check and convert the offenders?

Overall, we currently favor raw enums over typedefs:

$ git grep '^enum' | wc
    518    1226   25319
$ git grep '^typedef enum' | wc
    140     488    6520

But those numbers are misleading; in all of our public headers:

$ git grep '^enum' include/ |wc
      0       0       0
$ git grep '^typedef enum' include/ |wc
     79     237    3475

I decided not to push a patch adding the typedef, after all, at least
not until we decide whether it makes a difference style wise.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]