@@ -1199,26 +1199,36 @@ PB_API const pb_Name *pb_oneofname(const pb_Type *t, int idx) {
11991199}
12001200
12011201PB_API int pb_nexttype (const pb_State * S , const pb_Type * * ptype ) {
1202- const pb_TypeEntry * e = NULL ;
12031202 if (S != NULL ) {
1204- if (* ptype != NULL )
1205- e = (pb_TypeEntry * )pb_gettable (& S -> types , (pb_Key )(* ptype )-> name );
1206- while (pb_nextentry (& S -> types , (const pb_Entry * * )& e ))
1203+ const pb_Entry * ent = NULL ;
1204+ if (* ptype != NULL ) {
1205+ const pb_TypeEntry * e = (const pb_TypeEntry * )
1206+ pb_gettable (& S -> types , (pb_Key )(* ptype )-> name );
1207+ ent = & e -> entry ;
1208+ }
1209+ while (pb_nextentry (& S -> types , & ent )) {
1210+ const pb_TypeEntry * e = (const pb_TypeEntry * )ent ;
12071211 if ((* ptype = e -> value ) != NULL && !(* ptype )-> is_dead )
12081212 return 1 ;
1213+ }
12091214 }
12101215 * ptype = NULL ;
12111216 return 0 ;
12121217}
12131218
12141219PB_API int pb_nextfield (const pb_Type * t , const pb_Field * * pfield ) {
1215- const pb_FieldEntry * e = NULL ;
12161220 if (t != NULL ) {
1217- if (* pfield != NULL )
1218- e = (pb_FieldEntry * )pb_gettable (& t -> field_tags , (* pfield )-> number );
1219- while (pb_nextentry (& t -> field_tags , (const pb_Entry * * )& e ))
1221+ const pb_Entry * ent = NULL ;
1222+ if (* pfield != NULL ) {
1223+ const pb_FieldEntry * e = (const pb_FieldEntry * )
1224+ pb_gettable (& t -> field_tags , (* pfield )-> number );
1225+ ent = & e -> entry ;
1226+ }
1227+ while (pb_nextentry (& t -> field_tags , & ent )) {
1228+ const pb_FieldEntry * e = (const pb_FieldEntry * )ent ;
12201229 if ((* pfield = e -> value ) != NULL )
12211230 return 1 ;
1231+ }
12221232 }
12231233 * pfield = NULL ;
12241234 return 0 ;
0 commit comments