Skip to content

Commit

Permalink
try to fix alias issue #261
Browse files Browse the repository at this point in the history
  • Loading branch information
starwing committed Mar 13, 2024
1 parent 223b1a0 commit 38e7576
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions pb.h
Original file line number Diff line number Diff line change
Expand Up @@ -1199,26 +1199,36 @@ PB_API const pb_Name *pb_oneofname(const pb_Type *t, int idx) {
}

PB_API int pb_nexttype(const pb_State *S, const pb_Type **ptype) {
const pb_TypeEntry *e = NULL;
if (S != NULL) {
if (*ptype != NULL)
e = (pb_TypeEntry*)pb_gettable(&S->types, (pb_Key)(*ptype)->name);
while (pb_nextentry(&S->types, (const pb_Entry**)&e))
const pb_Entry *ent = NULL;
if (*ptype != NULL) {
const pb_TypeEntry *e = (pb_TypeEntry*)
pb_gettable(&S->types, (pb_Key)(*ptype)->name);
ent = &e->entry;
}
while (pb_nextentry(&S->types, &ent)) {
const pb_TypeEntry *e = (pb_TypeEntry*)ent;
if ((*ptype = e->value) != NULL && !(*ptype)->is_dead)
return 1;
}
}
*ptype = NULL;
return 0;
}

PB_API int pb_nextfield(const pb_Type *t, const pb_Field **pfield) {
const pb_FieldEntry *e = NULL;
if (t != NULL) {
if (*pfield != NULL)
e = (pb_FieldEntry*)pb_gettable(&t->field_tags, (*pfield)->number);
while (pb_nextentry(&t->field_tags, (const pb_Entry**)&e))
const pb_Entry *ent = NULL;
if (*pfield != NULL) {
const pb_FieldEntry *e = (pb_FieldEntry*)
pb_gettable(&t->field_tags, (*pfield)->number);
ent = &e->entry;
}
while (pb_nextentry(&t->field_tags, &ent)) {
const pb_FieldEntry *e = (pb_FieldEntry*)ent;
if ((*pfield = e->value) != NULL)
return 1;
}
}
*pfield = NULL;
return 0;
Expand Down

0 comments on commit 38e7576

Please sign in to comment.