From dc75a0bfcb3ca24726ed5405308a6194bf01d633 Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 25 Oct 2021 13:42:29 +0200 Subject: glib-utils: drop strcmp_null_tolerant --- src/actions.c | 2 +- src/file-utils.c | 2 +- src/glib-utils.c | 13 ------------- src/glib-utils.h | 1 - 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/actions.c b/src/actions.c index 31a9272..98028e4 100644 --- a/src/actions.c +++ b/src/actions.c @@ -122,7 +122,7 @@ get_full_uri (DlgNewData *data) uri_ext = get_archive_filename_extension (uri); default_ext = mime_type_desc[data->supported_types[idx-1]].default_ext; - if (strcmp_null_tolerant (uri_ext, default_ext) != 0) + if (g_strcmp0 (uri_ext, default_ext) != 0) full_uri = g_strconcat (uri, default_ext, NULL); } if (full_uri == NULL) diff --git a/src/file-utils.c b/src/file-utils.c index 04f6381..64e3b30 100644 --- a/src/file-utils.c +++ b/src/file-utils.c @@ -1246,7 +1246,7 @@ int uricmp (const char *uri1, const char *uri2) { - return strcmp_null_tolerant (uri1, uri2); + return g_strcmp0 (uri1, uri2); } char * diff --git a/src/glib-utils.c b/src/glib-utils.c index 8f3722b..2f9c02e 100644 --- a/src/glib-utils.c +++ b/src/glib-utils.c @@ -85,19 +85,6 @@ str_substitute (const char *str, return g_string_free (gstr, FALSE); } -int -strcmp_null_tolerant (const char *s1, const char *s2) -{ - if ((s1 == NULL) && (s2 == NULL)) - return 0; - else if ((s1 != NULL) && (s2 == NULL)) - return 1; - else if ((s1 == NULL) && (s2 != NULL)) - return -1; - else - return strcmp (s1, s2); -} - /* counts how many characters to escape in @str. */ static int count_chars_to_escape (const char *str, diff --git a/src/glib-utils.h b/src/glib-utils.h index 6631892..0f67f02 100644 --- a/src/glib-utils.h +++ b/src/glib-utils.h @@ -40,7 +40,6 @@ gboolean strchrs (const char *str, char * str_substitute (const char *str, const char *from_str, const char *to_str); -int strcmp_null_tolerant (const char *s1, const char *s2); char* escape_str (const char *str, const char *meta_chars); gboolean match_regexps (GRegex **regexps, -- cgit v1.2.1