summaryrefslogtreecommitdiff
path: root/upb/table.c
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2011-09-20 20:32:25 -0700
committerJoshua Haberman <jhaberman@gmail.com>2011-09-20 20:32:25 -0700
commitc0a08a6827a294f74b0ee5feaf5542081cff4381 (patch)
treea54e053d050f648d52369fcf2932fdc7a872703f /upb/table.c
parent56f7a345d7572e118d4a370bb8e79b328d16bc0e (diff)
Fixes to get upb to compile inside Google.
Diffstat (limited to 'upb/table.c')
-rw-r--r--upb/table.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/upb/table.c b/upb/table.c
index f0d8d3e..31c91b1 100644
--- a/upb/table.c
+++ b/upb/table.c
@@ -189,7 +189,7 @@ void upb_inttable_compact(upb_inttable *t) {
int lg2_array = 0;
while ((1UL << lg2_array) < largest_key) ++lg2_array;
++lg2_array; // Undo the first iteration.
- size_t array_size;
+ size_t array_size = 0;
int array_count = 0;
while (lg2_array > 0) {
array_size = (1 << --lg2_array);
@@ -306,10 +306,12 @@ void *upb_strtable_lookup(const upb_strtable *t, const char *key) {
void *upb_strtable_lookupl(const upb_strtable *t, const char *key, size_t len) {
// TODO: improve.
- char key2[len+1];
+ char *key2 = malloc(len+1);
memcpy(key2, key, len);
key2[len] = '\0';
- return upb_strtable_lookup(t, key2);
+ void *ret = upb_strtable_lookup(t, key2);
+ free(key2);
+ return ret;
}
static uint32_t empty_strbucket(upb_strtable *table) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback