summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--upb/table.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/upb/table.c b/upb/table.c
index 99ae5c3..4239c6f 100644
--- a/upb/table.c
+++ b/upb/table.c
@@ -270,9 +270,9 @@ static size_t begin(const upb_table *t) {
/* A simple "subclass" of upb_table that only adds a hash function for strings. */
static upb_tabkey strcopy(lookupkey_t k2, upb_alloc *a) {
+ uint32_t len = (uint32_t) k2.str.len;
char *str = upb_malloc(a, k2.str.len + sizeof(uint32_t) + 1);
if (str == NULL) return 0;
- uint32_t len = (uint32_t) k2.str.len;
memcpy(str, &len, sizeof(uint32_t));
memcpy(str + sizeof(uint32_t), k2.str.str, k2.str.len + 1);
return (uintptr_t)str;
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback