diff --git a/daemon/redis.c b/daemon/redis.c index b10186ff1a..0f8fdbe078 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -1025,7 +1025,7 @@ static void json_get_hash_iter(const ng_parser_t *parser, str *key, parser_arg v } // XXX convert to proper str ht - char *tmp = g_memdup2(key->s, key->len + 1); + char *tmp = __g_memdup(key->s, key->len + 1); tmp[key->len] = '\0'; // XXX eliminate string dup? eliminate URI decode? if (g_hash_table_insert(arg.ht, tmp, str_uri_decode_len(val.s, val.len)) != TRUE) diff --git a/lib/str.h b/lib/str.h index cac4ea5d7a..a8ba82b331 100644 --- a/lib/str.h +++ b/lib/str.h @@ -42,11 +42,7 @@ TYPED_GQUEUE(str, str) #define STR_GS(s) ((str) { (s)->str, (s)->len }) #define STR_LEN(s, len) ((str) { (char *) (s), len }) #define STR_LEN_ASSERT(s, len) ({ assert(sizeof(s) >= len); (str) { (char *) (s), len }; }) -#if GLIB_CHECK_VERSION(2,68,0) -#define STR_DUP(s) ({ size_t __l = strlen(s); (str) { g_memdup2(s, __l + 1), __l }; }) -#else -#define STR_DUP(s) ((str) { g_strdup(s), strlen(s) }) -#endif +#define STR_DUP(s) ({ size_t __l = strlen(s); (str) { __g_memdup(s, __l + 1), __l }; }) #define STR_CONST_BUF(buf) ((str) { (char *) &buf, sizeof(buf) })