restore upb_MapIterator_Done()

It turns out that we still need this for PHP. Oops.

PiperOrigin-RevId: 490034622
pull/13171/head
Eric Salo 2 years ago committed by Copybara-Service
parent 907d705e86
commit 2644ae7507
  1. 8
      upb/collections/map.c
  2. 5
      upb/collections/map.h

@ -92,6 +92,14 @@ bool upb_MapIterator_Next(const upb_Map* map, size_t* iter) {
return _upb_map_next(map, iter);
}
bool upb_MapIterator_Done(const upb_Map* map, size_t iter) {
upb_strtable_iter i;
UPB_ASSERT(iter != kUpb_Map_Begin);
i.t = &map->table;
i.index = iter;
return upb_strtable_done(&i);
}
// Returns the key and value for this entry of the map.
upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter) {
upb_strtable_iter i;

@ -107,6 +107,11 @@ bool upb_Map_Next(const upb_Map* map, upb_MessageValue* key,
// Advances to the next entry. Returns false if no more entries are present.
bool upb_MapIterator_Next(const upb_Map* map, size_t* iter);
/* Returns true if the iterator still points to a valid entry, or false if the
* iterator is past the last element. It is an error to call this function with
* kUpb_Map_Begin (you must call next() at least once first). */
bool upb_MapIterator_Done(const upb_Map* map, size_t iter);
/* Returns the key and value for this entry of the map. */
upb_MessageValue upb_MapIterator_Key(const upb_Map* map, size_t iter);
upb_MessageValue upb_MapIterator_Value(const upb_Map* map, size_t iter);

Loading…
Cancel
Save