Skip to content

upb: Update _upb_map_next signature to return a boolean and remove th… #20467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions upb/message/internal/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,13 @@ UPB_INLINE void _upb_map_fromvalue(upb_value val, void* out, size_t size) {
}
}

UPB_INLINE void* _upb_map_next(const struct upb_Map* map, size_t* iter) {
UPB_INLINE bool _upb_map_next(const struct upb_Map* map, size_t* iter) {
upb_strtable_iter it;
it.t = &map->table;
it.index = *iter;
upb_strtable_next(&it);
*iter = it.index;
if (upb_strtable_done(&it)) return NULL;
return (void*)str_tabent(&it);
return !upb_strtable_done(&it);
}

UPB_INLINE void _upb_Map_Clear(struct upb_Map* map) {
Expand Down
11 changes: 0 additions & 11 deletions upb_generator/c/generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -671,17 +671,6 @@ void GenerateMapSetters(upb::FieldDefPtr field, const DefPoolPair& pools,
)cc",
msg_name, resolved_name, MapKeyCType(field),
FieldInitializer(pools, field, options), MapKeySize(field, "key"));
output(
R"cc(
UPB_INLINE $0 $1_$2_nextmutable($1* msg, size_t* iter) {
const upb_MiniTableField field = $3;
upb_Map* map = (upb_Map*)upb_Message_GetMap(UPB_UPCAST(msg), &field);
if (!map) return NULL;
return ($0)_upb_map_next(map, iter);
}
)cc",
CType(field), msg_name, resolved_name,
FieldInitializerStrong(pools, field, options));
}

void GenerateRepeatedSetters(upb::FieldDefPtr field, const DefPoolPair& pools,
Expand Down
Loading