diff --git a/upb/msg.h b/upb/msg.h index da226f917a..743625b7bd 100644 --- a/upb/msg.h +++ b/upb/msg.h @@ -268,7 +268,9 @@ UPB_INLINE bool _upb_map_get(const upb_map *map, const void *key, } UPB_INLINE void* _upb_map_next(const upb_map *map, size_t *iter) { - upb_strtable_iter it = {&map->table, *iter}; + upb_strtable_iter it; + it.t = &map->table; + it.index = *iter; upb_strtable_next(&it); if (upb_strtable_done(&it)) return NULL; *iter = it.index; @@ -345,7 +347,8 @@ UPB_INLINE void _upb_msg_map_clear(upb_msg *msg, size_t ofs) { UPB_INLINE void _upb_msg_map_key(const void* msg, void* key, size_t size) { const upb_tabent *ent = (const upb_tabent*)msg; uint32_t u32len; - upb_strview k = {upb_tabstr(ent->key, &u32len)}; + upb_strview k; + k.data = upb_tabstr(ent->key, &u32len); k.size = u32len; _upb_map_fromkey(k, key, size); } diff --git a/upb/reflection.c b/upb/reflection.c index 11db23b999..c7242d51f9 100644 --- a/upb/reflection.c +++ b/upb/reflection.c @@ -227,18 +227,20 @@ bool upb_mapiter_next(const upb_map *map, size_t *iter) { /* Returns the key and value for this entry of the map. */ upb_msgval upb_mapiter_key(const upb_map *map, size_t iter) { - upb_strtable_iter i = {&map->table, iter}; - upb_strview key = upb_strtable_iter_key(&i); + upb_strtable_iter i; upb_msgval ret; - _upb_map_fromkey(key, &ret, map->key_size); + i.t = &map->table; + i.index = iter; + _upb_map_fromkey(upb_strtable_iter_key(&i), &ret, map->key_size); return ret; } upb_msgval upb_mapiter_value(const upb_map *map, size_t iter) { - upb_strtable_iter i = {&map->table, iter}; - upb_value val = upb_strtable_iter_value(&i); + upb_strtable_iter i; upb_msgval ret; - _upb_map_fromvalue(val, &ret, map->val_size); + i.t = &map->table; + i.index = iter; + _upb_map_fromvalue(upb_strtable_iter_value(&i), &ret, map->val_size); return ret; }