MCPcopy Create free account
hub / github.com/Tencent/UnLua / pb_deltype

Function pb_deltype

Plugins/UnLuaExtensions/LuaProtobuf/Source/src/pb.h:1267–1292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1265}
1266
1267PB_API void pb_deltype(pb_State *S, pb_Type *t) {
1268 pb_FieldEntry *nf = NULL;
1269 pb_OneofEntry *ne = NULL;
1270 if (S == NULL || t == NULL) return;
1271 while (pb_nextentry(&t->field_names, (const pb_Entry**)&nf)) {
1272 if (nf->value != NULL) {
1273 pb_FieldEntry *of = (pb_FieldEntry*)pb_gettable(
1274 &t->field_tags, nf->value->number);
1275 if (of && of->value == nf->value)
1276 of->entry.key = 0, of->value = NULL;
1277 pbT_freefield(S, nf->value);
1278 }
1279 }
1280 while (pb_nextentry(&t->field_tags, (const pb_Entry**)&nf))
1281 if (nf->value != NULL) pbT_freefield(S, nf->value);
1282 while (pb_nextentry(&t->oneof_index, (const pb_Entry**)&ne))
1283 pb_delname(S, ne->name);
1284 pb_freetable(&t->field_tags);
1285 pb_freetable(&t->field_names);
1286 pb_freetable(&t->oneof_index);
1287 t->oneof_field = 0, t->field_count = 0;
1288 t->is_dead = 1;
1289 pb_delsort(t);
1290 /*pb_delname(S, t->name); */
1291 /*pb_poolfree(&S->typepool, t); */
1292}
1293
1294PB_API pb_Field *pb_newfield(pb_State *S, pb_Type *t, pb_Name *fname, int32_t number) {
1295 pb_FieldEntry *nf, *tf;

Callers 2

pb_freeFunction · 0.85
Lpb_clearFunction · 0.85

Calls 6

pb_nextentryFunction · 0.85
pb_gettableFunction · 0.85
pbT_freefieldFunction · 0.85
pb_delnameFunction · 0.85
pb_freetableFunction · 0.85
pb_delsortFunction · 0.85

Tested by

no test coverage detected