[PATCH v3 11/16] tools/libs/store: make libxenstore independent of utils.h

Juergen Gross posted 16 patches 2 years, 8 months ago
There is a newer version of this series
[PATCH v3 11/16] tools/libs/store: make libxenstore independent of utils.h
Posted by Juergen Gross 2 years, 8 months ago
There is no real need for including tools/xenstore/utils.h from
libxenstore, as only streq() and ARRAY_SIZE() are obtained via that
header.

streq() is just !strcmp(), and ARRAY_SIZE() is brought in via
xen-tools/common-macros.h.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
V3:
- new patch
---
 tools/libs/store/xs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libs/store/xs.c b/tools/libs/store/xs.c
index 3813b69ae2..76ffb1be45 100644
--- a/tools/libs/store/xs.c
+++ b/tools/libs/store/xs.c
@@ -33,9 +33,9 @@
 #include <signal.h>
 #include <stdint.h>
 #include <errno.h>
+#include <xen-tools/common-macros.h>
 #include "xenstore.h"
 #include "xs_lib.h"
-#include "utils.h"
 
 #include <xentoolcore_internal.h>
 #include <xen_list.h>
@@ -437,7 +437,7 @@ static int get_error(const char *errorstring)
 {
 	unsigned int i;
 
-	for (i = 0; !streq(errorstring, xsd_errors[i].errstring); i++)
+	for (i = 0; strcmp(errorstring, xsd_errors[i].errstring); i++)
 		if (i == ARRAY_SIZE(xsd_errors) - 1)
 			return EINVAL;
 	return xsd_errors[i].errnum;
-- 
2.35.3
Re: [PATCH v3 11/16] tools/libs/store: make libxenstore independent of utils.h
Posted by Julien Grall 2 years, 8 months ago
Hi Juergen,

On 30/05/2023 09:54, Juergen Gross wrote:
> There is no real need for including tools/xenstore/utils.h from
> libxenstore, as only streq() and ARRAY_SIZE() are obtained via that
> header.
> 
> streq() is just !strcmp(), and ARRAY_SIZE() is brought in via
> xen-tools/common-macros.h.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,

-- 
Julien Grall