Re: [PATCH 2/2] nwfilter: enum cleanups in "src/nwfilter/*"

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

 



On 06/15/2014 10:32 AM, Julio Faracco wrote:
> As we are doing with the enum structures, a cleanup in
> "src/nwfilter/" directory was done now. All the enums that were
> defined in the header files were converted to typedefs in this
> directory. This patch includes all the adjustments to remove
> conflicts when you do this kind of change. "Enum-to-typedef"'s
> conversions were made in "src/nwfilter/nwfilter_{gentech_driver,
> learnipaddr, tech_driver}.h".
> 
> Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
> ---
>  src/nwfilter/nwfilter_gentech_driver.c |   12 ++++++------
>  src/nwfilter/nwfilter_gentech_driver.h |    4 ++--
>  src/nwfilter/nwfilter_learnipaddr.c    |    2 +-
>  src/nwfilter/nwfilter_learnipaddr.h    |    8 ++++----
>  src/nwfilter/nwfilter_tech_driver.h    |    6 +++---
>  5 files changed, 16 insertions(+), 16 deletions(-)
> 

> diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
> index 5bed106..5a4c896 100644
> --- a/src/nwfilter/nwfilter_gentech_driver.c
> +++ b/src/nwfilter/nwfilter_gentech_driver.c
> @@ -332,7 +332,7 @@ static int
>  virNWFilterDefToInst(virNWFilterDriverStatePtr driver,
>                       virNWFilterDefPtr def,
>                       virNWFilterHashTablePtr vars,
> -                     enum instCase useNewFilter,
> +                     instCase useNewFilter,

It would be nice to do a followup patch that renames instCase into
something like virInstCase, to make it obvious that it is an enum type
provided by libvirt...

> +++ b/src/nwfilter/nwfilter_gentech_driver.h
> @@ -32,10 +32,10 @@ virNWFilterTechDriverPtr virNWFilterTechDriverForName(const char *name);
>  int virNWFilterTechDriversInit(bool privileged);
>  void virNWFilterTechDriversShutdown(void);
>  
> -enum instCase {
> +typedef enum {
>      INSTANTIATE_ALWAYS,
>      INSTANTIATE_FOLLOW_NEWFILTER,
> -};
> +} instCase;

...the current naming is too prone to collision with other library's
include files.

>  
>  
>  int virNWFilterInstantiateFilter(virNWFilterDriverStatePtr driver,
> diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
> index 4cea9cf..05bebbb 100644
> --- a/src/nwfilter/nwfilter_learnipaddr.c
> +++ b/src/nwfilter/nwfilter_learnipaddr.c
> @@ -771,7 +771,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver ATTRIBUTE_UNUSED,
>                            const char *filtername ATTRIBUTE_UNUSED,
>                            virNWFilterHashTablePtr filterparams ATTRIBUTE_UNUSED,
>                            virNWFilterDriverStatePtr driver ATTRIBUTE_UNUSED,
> -                          enum howDetect howDetect ATTRIBUTE_UNUSED)
> +                          howDetect howdetect ATTRIBUTE_UNUSED)

Same story for howDetect.

>  
> -enum techDrvFlags {
> +typedef enum {
>      TECHDRV_FLAG_INITIALIZED = (1 << 0),
> -};
> +} techDrvFlags;

Also this enum.

At any rate, your patch is a strict improvement, so ACK and pushed.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]