[libvirt] [PATCH v2] use STRNEQ instead of !STREQ and new syntax-check rule to avoid !STREQ and !STRNEQ

Michal Privoznik mprivozn at redhat.com
Wed Oct 21 13:10:23 UTC 2015


On 20.10.2015 18:15, Ishmanpreet Kaur Khera wrote:

The commit message subject is rather long.

> used STRNEQ instead of !STREQ to remove inconsistency and 
> intoduced new syntax-check rule for !STREQ and !STRNEQ so
> that we don't end up in the same situation again. 
> 
> Signed-off-by: Ishmanpreet Kaur Khera <khera.ishman at gmail.com>
> ---
>  cfg.mk                                | 18 ++++++++++++++++++
>  src/bhyve/bhyve_driver.c              |  2 +-
>  src/conf/network_conf.c               |  4 ++--
>  src/conf/nwfilter_conf.c              |  2 +-
>  src/conf/nwfilter_params.c            |  2 +-
>  src/conf/storage_conf.c               |  2 +-
>  src/lxc/lxc_fuse.c                    |  4 ++--
>  src/openvz/openvz_driver.c            |  2 +-
>  src/qemu/qemu_command.c               |  6 +++---
>  src/qemu/qemu_domain.c                |  2 +-
>  src/qemu/qemu_hotplug.c               |  2 +-
>  src/security/security_manager.c       |  2 +-
>  src/security/security_selinux.c       | 12 ++++++------
>  src/storage/storage_backend_logical.c |  2 +-
>  src/util/virfile.c                    |  2 +-
>  src/util/virsystemd.c                 |  2 +-
>  src/vz/vz_driver.c                    |  2 +-
>  src/vz/vz_sdk.c                       |  2 +-
>  src/xen/xend_internal.c               |  2 +-
>  src/xenconfig/xen_sxpr.c              |  2 +-
>  tests/commandtest.c                   | 10 +++++-----
>  tests/securityselinuxlabeltest.c      |  2 +-
>  tests/virauthconfigtest.c             |  2 +-
>  tests/virbitmaptest.c                 | 12 ++++++------
>  tests/vircgrouptest.c                 |  2 +-
>  tests/virkeyfiletest.c                |  8 ++++----
>  tests/virnetsockettest.c              |  2 +-
>  tests/virtypedparamtest.c             |  2 +-
>  tests/viruritest.c                    | 16 ++++++++--------
>  29 files changed, 74 insertions(+), 56 deletions(-)
> 
> diff --git a/cfg.mk b/cfg.mk
> index e436434..7343dfc 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -1011,6 +1011,18 @@ sc_prohibit_pthread_create:
>  	halt="avoid using 'pthread_create', use 'virThreadCreate' instead" \
>  	  $(_sc_search_regexp)
>  
> +sc_prohibit_not_streq:
> +       @prohibit='!STREQ'                \
> +       exclude='exempt from syntax-check'        \
> +       halt='Use STRNEQ instead of !STREQ'        \
> +         $(_sc_search_regexp)
> +
> +sc_prohibit_not_strneq:
> +       @prohibit='!STRNEQ'                \
> +       exclude='exempt from syntax-check'        \
> +       halt='Use STREQ instead of !STRNEQ'        \
> +         $(_sc_search_regexp)
> +

These need to look slightly different. Firstly, they are not indented
good, therefore they are not effective. Then, we must come up with
better pattern to match, otherwise we will match ourselves too. And I
believe 'exclude' won't be needed then:

diff --git a/cfg.mk b/cfg.mk
index 4c17980..a9bba38 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1012,16 +1012,14 @@ sc_prohibit_pthread_create:
          $(_sc_search_regexp)

 sc_prohibit_not_streq:
-       @prohibit='!STREQ'                \
-       exclude='exempt from syntax-check'        \
-       halt='Use STRNEQ instead of !STREQ'        \
-         $(_sc_search_regexp)
+       @prohibit='! *STREQ *\(.*\)'            \
+       halt='Use STRNEQ instead of !STREQ'     \
+         $(_sc_search_regexp)

 sc_prohibit_not_strneq:
-       @prohibit='!STRNEQ'                \
-       exclude='exempt from syntax-check'        \
-       halt='Use STREQ instead of !STRNEQ'        \
-         $(_sc_search_regexp)
+       @prohibit='! *STRNEQ *\(.*\)'       \
+       halt='Use STREQ instead of !STRNEQ'     \
+         $(_sc_search_regexp)

 # We don't use this feature of maint.mk.
 prev_version_file = /dev/null

This is what needs to be squashed in. What I just did, ACKed and pushed.

Congratulations on your first libvirt contribution!

Michal




More information about the libvir-list mailing list