[libvirt] [PATCH v2 01/12] virsh: Move the definition of macro VIRSH_COMMON_OPT_DOMAIN_FULL to virsh.h

Lin Ma posted 12 patches 7 years ago
[libvirt] [PATCH v2 01/12] virsh: Move the definition of macro VIRSH_COMMON_OPT_DOMAIN_FULL to virsh.h
Posted by Lin Ma 7 years ago
centralize the definition of macro VIRSH_COMMON_OPT_DOMAIN_FULL to virsh.h
to avoid unnecessary duplicated definition

Signed-off-by: Lin Ma <lma@suse.com>
---
 tools/virsh-domain-monitor.c | 3 ---
 tools/virsh-domain.c         | 3 ---
 tools/virsh-snapshot.c       | 3 ---
 tools/virsh.h                | 3 +++
 4 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 8e071779b4..071619d0e3 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -40,9 +40,6 @@
 #include "virxml.h"
 #include "virstring.h"
 
-#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
-    VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
-
 VIR_ENUM_DECL(virshDomainIOError)
 VIR_ENUM_IMPL(virshDomainIOError,
               VIR_DOMAIN_DISK_ERROR_LAST,
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 598d2fa4a4..aa11a81638 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -65,9 +65,6 @@
 # define SA_SIGINFO 0
 #endif
 
-#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
-    VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
-
 #define VIRSH_COMMON_OPT_DOMAIN_PERSISTENT \
     {.name = "persistent", \
      .type = VSH_OT_BOOL, \
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index e4908eea70..812fa91333 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -42,9 +42,6 @@
 #include "virxml.h"
 #include "conf/snapshot_conf.h"
 
-#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
-    VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
-
 /* Helper for snapshot-create and snapshot-create-as */
 static bool
 virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer,
diff --git a/tools/virsh.h b/tools/virsh.h
index f2213ebb57..9e717ef574 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -82,6 +82,9 @@
      .completer_flags = cflags, \
     }
 
+#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
+    VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
+
 # define VIRSH_COMMON_OPT_CONFIG(_helpstr) \
     {.name = "config", \
      .type = VSH_OT_BOOL, \
-- 
2.15.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 01/12] virsh: Move the definition of macro VIRSH_COMMON_OPT_DOMAIN_FULL to virsh.h
Posted by Michal Privoznik 7 years ago
On 05/08/2018 04:20 PM, Lin Ma wrote:
> centralize the definition of macro VIRSH_COMMON_OPT_DOMAIN_FULL to virsh.h
> to avoid unnecessary duplicated definition
> 
> Signed-off-by: Lin Ma <lma@suse.com>
> ---
>  tools/virsh-domain-monitor.c | 3 ---
>  tools/virsh-domain.c         | 3 ---
>  tools/virsh-snapshot.c       | 3 ---
>  tools/virsh.h                | 3 +++
>  4 files changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
> index 8e071779b4..071619d0e3 100644
> --- a/tools/virsh-domain-monitor.c
> +++ b/tools/virsh-domain-monitor.c
> @@ -40,9 +40,6 @@
>  #include "virxml.h"
>  #include "virstring.h"
>  
> -#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
> -    VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
> -
>  VIR_ENUM_DECL(virshDomainIOError)
>  VIR_ENUM_IMPL(virshDomainIOError,
>                VIR_DOMAIN_DISK_ERROR_LAST,
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 598d2fa4a4..aa11a81638 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -65,9 +65,6 @@
>  # define SA_SIGINFO 0
>  #endif
>  
> -#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
> -    VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
> -
>  #define VIRSH_COMMON_OPT_DOMAIN_PERSISTENT \
>      {.name = "persistent", \
>       .type = VSH_OT_BOOL, \
> diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
> index e4908eea70..812fa91333 100644
> --- a/tools/virsh-snapshot.c
> +++ b/tools/virsh-snapshot.c
> @@ -42,9 +42,6 @@
>  #include "virxml.h"
>  #include "conf/snapshot_conf.h"
>  
> -#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
> -    VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)
> -
>  /* Helper for snapshot-create and snapshot-create-as */
>  static bool
>  virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer,
> diff --git a/tools/virsh.h b/tools/virsh.h
> index f2213ebb57..9e717ef574 100644
> --- a/tools/virsh.h
> +++ b/tools/virsh.h
> @@ -82,6 +82,9 @@
>       .completer_flags = cflags, \
>      }
>  
> +#define VIRSH_COMMON_OPT_DOMAIN_FULL(cflags) \
> +    VIRSH_COMMON_OPT_DOMAIN(N_("domain name, id or uuid"), cflags)

This needs to be:

# define VIRSH_...

because it's nested #define. syntax-check would catch this.

ACK with that fixed.

Michal

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