From b95b3724f522c3d7ab2ede752e2913287b172b8e Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Thu, 6 Feb 2020 21:27:40 -0500 Subject: [PATCH] Avoid GLib deprecation warnings when building gob. The g_strdown functions are deprecated in GLib, we already have a gob_strdown function which does the same thing with g_ascii_tolower, but it seems a couple spots were missed. There is also a call to g_strcasecmp which can be replaced by g_ascii_strcasecmp. --- src/checks.c | 8 +++++--- src/parse.y | 4 ++-- src/util.c | 6 ++++++ src/util.h | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/checks.c b/src/checks.c index c651e9a..683fe00 100644 --- a/src/checks.c +++ b/src/checks.c @@ -195,10 +195,12 @@ check_duplicate_named (Class *c, Node *node, const char *id, int line_no) } else { continue; } - if (n == node || - line_no >= nline_no || - g_strcasecmp (nid, id) != 0) + + if (n == node || line_no >= nline_no + || gob_strcasecmp (nid, id) != 0) + { continue; + } error_printf (GOB_ERROR, nline_no, "named symbol (argument or signal) '%s' " "redefined, first defined on line %d " diff --git a/src/parse.y b/src/parse.y index 662f990..9b29d25 100644 --- a/src/parse.y +++ b/src/parse.y @@ -614,9 +614,9 @@ property_link_and_export (Node *node) const char *setcast = ""; char *to_free = NULL; set_func = g_strdup_printf ("g_value_set_%s", prop->gtktype); - g_strdown (set_func); + gob_strdown (set_func); get_func = g_strdup_printf ("g_value_get_%s", prop->gtktype); - g_strdown (get_func); + gob_strdown (get_func); if (for_cpp) { if (strcmp (prop->gtktype, "FLAGS") == 0) { diff --git a/src/util.c b/src/util.c index 6405190..0b26fa1 100644 --- a/src/util.c +++ b/src/util.c @@ -407,6 +407,12 @@ gob_strdown (char *str) return str; } +int +gob_strcasecmp(const char *s1, const char *s2) +{ + return g_ascii_strcasecmp(s1, s2); +} + char * gob_str_delete_quotes(char *str) { diff --git a/src/util.h b/src/util.h index daf6cf5..bb69ed2 100644 --- a/src/util.h +++ b/src/util.h @@ -37,9 +37,11 @@ void error_printf(int type, int line, const char *error, ...) G_GNUC_PRINTF (3, char * remove_sep(const char *base); /* replace the : separator from a typename with a different character*/ char * replace_sep(const char *base, char r); + char * gob_strup (char *s); char * gob_strdown (char *s); char * gob_str_delete_quotes(char *str); +int gob_strcasecmp(const char *s1, const char *s2); /*separate the namespace part and then replace rest of separators with r*/ -- 2.43.0