[libvirt] [PATCH 0/4] drop usage of c-strcase gnulib module

Pavel Hrdina (4): use g_ascii_strcasecmp instead of c_strcasecmp from gnulib use g_ascii_strncasecmp instead of c_strncasecmp from gnulib syntax-check: update strcase check to refer to GLib bootstrap.conf: drop usage of c-strcase gnulib module bootstrap.conf | 1 - build-aux/syntax-check.mk | 2 +- src/internal.h | 11 +++++------ tests/virhashtest.c | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) -- 2.23.0

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/internal.h | 4 ++-- tests/virhashtest.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/internal.h b/src/internal.h index 0ff9f496ac..0780e2a2a3 100644 --- a/src/internal.h +++ b/src/internal.h @@ -75,9 +75,9 @@ /* String equality tests, suggested by Jim Meyering. */ #define STREQ(a, b) (strcmp(a, b) == 0) -#define STRCASEEQ(a, b) (c_strcasecmp(a, b) == 0) +#define STRCASEEQ(a, b) (g_ascii_strcasecmp(a, b) == 0) #define STRNEQ(a, b) (strcmp(a, b) != 0) -#define STRCASENEQ(a, b) (c_strcasecmp(a, b) != 0) +#define STRCASENEQ(a, b) (g_ascii_strcasecmp(a, b) != 0) #define STREQLEN(a, b, n) (strncmp(a, b, n) == 0) #define STRCASEEQLEN(a, b, n) (c_strncasecmp(a, b, n) == 0) #define STRNEQLEN(a, b, n) (strncmp(a, b, n) != 0) diff --git a/tests/virhashtest.c b/tests/virhashtest.c index 3132095463..66fa3a428e 100644 --- a/tests/virhashtest.c +++ b/tests/virhashtest.c @@ -446,7 +446,7 @@ testHashGetItems(const void *data G_GNUC_UNUSED) static int testHashEqualCompValue(const void *value1, const void *value2) { - return c_strcasecmp(value1, value2); + return g_ascii_strcasecmp(value1, value2); } static int -- 2.23.0

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/internal.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/internal.h b/src/internal.h index 0780e2a2a3..3d1e21f0cf 100644 --- a/src/internal.h +++ b/src/internal.h @@ -63,7 +63,6 @@ #include "libvirt/libvirt-admin.h" #include "libvirt/virterror.h" -#include "c-strcase.h" #include "glibcompat.h" /* Merely casting to (void) is not sufficient since the @@ -79,11 +78,11 @@ #define STRNEQ(a, b) (strcmp(a, b) != 0) #define STRCASENEQ(a, b) (g_ascii_strcasecmp(a, b) != 0) #define STREQLEN(a, b, n) (strncmp(a, b, n) == 0) -#define STRCASEEQLEN(a, b, n) (c_strncasecmp(a, b, n) == 0) +#define STRCASEEQLEN(a, b, n) (g_ascii_strncasecmp(a, b, n) == 0) #define STRNEQLEN(a, b, n) (strncmp(a, b, n) != 0) -#define STRCASENEQLEN(a, b, n) (c_strncasecmp(a, b, n) != 0) +#define STRCASENEQLEN(a, b, n) (g_ascii_strncasecmp(a, b, n) != 0) #define STRPREFIX(a, b) (strncmp(a, b, strlen(b)) == 0) -#define STRCASEPREFIX(a, b) (c_strncasecmp(a, b, strlen(b)) == 0) +#define STRCASEPREFIX(a, b) (g_ascii_strncasecmp(a, b, strlen(b)) == 0) #define STRSKIP(a, b) (STRPREFIX(a, b) ? (a) + strlen(b) : NULL) #define STREQ_NULLABLE(a, b) (g_strcmp0(a, b) == 0) -- 2.23.0

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- build-aux/syntax-check.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index f1e976ec76..047c48ae83 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -588,7 +588,7 @@ sc_avoid_ctype_macros: sc_avoid_strcase: @prohibit='\bstrn?case(cmp|str) *\(' \ - halt='use c-strcase.h instead of raw strcase functions' \ + halt='use GLib strcase functions instead of raw strcase functions' \ $(_sc_search_regexp) sc_prohibit_virBufferAdd_with_string_literal: -- 2.23.0

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- bootstrap.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/bootstrap.conf b/bootstrap.conf index abb03bf3a2..d0a39537eb 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -21,7 +21,6 @@ gnulib_modules=' accept bind c-ctype -c-strcase canonicalize-lgpl chown clock-time -- 2.23.0

On 11/20/19 9:54 AM, Pavel Hrdina wrote:
Pavel Hrdina (4): use g_ascii_strcasecmp instead of c_strcasecmp from gnulib use g_ascii_strncasecmp instead of c_strncasecmp from gnulib syntax-check: update strcase check to refer to GLib bootstrap.conf: drop usage of c-strcase gnulib module
bootstrap.conf | 1 - build-aux/syntax-check.mk | 2 +- src/internal.h | 11 +++++------ tests/virhashtest.c | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-)
Reviewed-by: Cole Robinson <crobinso@redhat.com> - Cole
participants (2)
-
Cole Robinson
-
Pavel Hrdina