Skip to content

Commit

Permalink
MT#55283 handle g_memdup2 legacy
Browse files Browse the repository at this point in the history
Change-Id: I61ebca94924e7abdda01ce4d4bd99cef8cddfd81
  • Loading branch information
rfuchs committed Aug 16, 2024
1 parent 7dd2235 commit ac41df5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion daemon/redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 1 addition & 5 deletions lib/str.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) })


Expand Down

0 comments on commit ac41df5

Please sign in to comment.