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

Function pb_sortfield

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

Source from the content-addressed store, hash-verified

1167}
1168
1169PB_API pb_Field** pb_sortfield(pb_Type* t) {
1170 if (!t->field_sort && t->field_count) {
1171 int index = 0;
1172 unsigned int i = 0;
1173 const pb_Field* f = NULL;
1174 pb_Field** list = (pb_Field**)malloc(sizeof(pb_Field*) * t->field_count);
1175
1176 assert(list);
1177 while (pb_nextfield(t, &f)) {
1178 list[index++] = (pb_Field*)f;
1179 }
1180
1181 qsort(list, index, sizeof(pb_Field*), comp_field);
1182 for (i = 0; i < t->field_count; i++) {
1183 list[i]->sort_index = i + 1;
1184 }
1185 t->field_sort = list;
1186 }
1187
1188 return t->field_sort;
1189}
1190
1191PB_API const pb_Name *pb_oneofname(const pb_Type *t, int idx) {
1192 pb_OneofEntry *oe = NULL;

Callers 2

lpbE_packFunction · 0.85
lpbD_unpackFunction · 0.85

Calls 1

pb_nextfieldFunction · 0.85

Tested by

no test coverage detected