@@ -28148,6 +28148,7 @@ void flecs_rest_shrink_memory(
2814828148 ecs_world_t *world,
2814928149 void *ctx)
2815028150{
28151+ (void)ctx;
2815128152 ecs_shrink(world);
2815228153}
2815328154
@@ -28158,6 +28159,8 @@ bool flecs_rest_action(
2815828159 ecs_http_reply_t *reply,
2815928160 const char *path)
2816028161{
28162+ (void)path;
28163+
2816128164 char *action = &req->path[7];
2816228165 ecs_dbg_2("rest: run action '%s'", action);
2816328166
@@ -49241,14 +49244,15 @@ int flecs_json_serialize_table_components(
4924149244}
4924249245
4924349246static
49244- bool flecs_json_serialize_table_inherited_type(
49247+ int flecs_json_serialize_table_inherited_type(
4924549248 const ecs_world_t *world,
4924649249 ecs_table_t *table,
4924749250 ecs_strbuf_t *buf,
49248- const ecs_iter_to_json_desc_t *desc)
49251+ const ecs_iter_to_json_desc_t *desc,
49252+ bool *has_inherited)
4924949253{
4925049254 if (!(table->flags & EcsTableHasIsA)) {
49251- return false ;
49255+ return 0 ;
4925249256 }
4925349257
4925449258 const ecs_table_record_t *tr = flecs_component_get_table(
@@ -49264,7 +49268,11 @@ bool flecs_json_serialize_table_inherited_type(
4926449268 }
4926549269
4926649270 ecs_table_t *base_table = base_record->table;
49267- flecs_json_serialize_table_inherited_type(world, base_table, buf, desc);
49271+ if (flecs_json_serialize_table_inherited_type(
49272+ world, base_table, buf, desc, has_inherited))
49273+ {
49274+ return -1;
49275+ }
4926849276
4926949277 char *base_name = ecs_get_path(world, base);
4927049278 flecs_json_member(buf, base_name);
@@ -49279,9 +49287,12 @@ bool flecs_json_serialize_table_inherited_type(
4927949287 buf, desc);
4928049288
4928149289 int32_t component_count = 0;
49282- flecs_json_serialize_table_components(
49290+ if ( flecs_json_serialize_table_components(
4928349291 world, base_table, table, buf, NULL, desc,
49284- ECS_RECORD_TO_ROW(base_record->row), &component_count);
49292+ ECS_RECORD_TO_ROW(base_record->row), &component_count))
49293+ {
49294+ return -1;
49295+ }
4928549296
4928649297 if (desc->serialize_type_info) {
4928749298 flecs_json_serialize_table_type_info(
@@ -49291,56 +49302,69 @@ bool flecs_json_serialize_table_inherited_type(
4929149302 flecs_json_object_pop(buf);
4929249303 }
4929349304
49294- return true;
49305+ *has_inherited = true;
49306+ return 0;
4929549307}
4929649308
4929749309static
49298- bool flecs_json_serialize_table_inherited(
49310+ int flecs_json_serialize_table_inherited(
4929949311 const ecs_world_t *world,
4930049312 ecs_table_t *table,
4930149313 ecs_strbuf_t *buf,
49302- const ecs_iter_to_json_desc_t *desc)
49314+ const ecs_iter_to_json_desc_t *desc,
49315+ bool *has_inherited)
4930349316{
4930449317 if (!(table->flags & EcsTableHasIsA)) {
49305- return false ;
49318+ return 0 ;
4930649319 }
4930749320
4930849321 flecs_json_memberl(buf, "inherited");
4930949322 flecs_json_object_push(buf);
49310- flecs_json_serialize_table_inherited_type(world, table, buf, desc);
49323+ if (flecs_json_serialize_table_inherited_type(
49324+ world, table, buf, desc, has_inherited))
49325+ {
49326+ return -1;
49327+ }
4931149328 flecs_json_object_pop(buf);
49312- return true ;
49329+ return 0 ;
4931349330}
4931449331
4931549332static
49316- bool flecs_json_serialize_table_tags_pairs_vars(
49333+ int flecs_json_serialize_table_tags_pairs_vars(
4931749334 const ecs_world_t *world,
4931849335 const ecs_iter_t *it,
4931949336 ecs_table_t *table,
4932049337 int32_t row,
4932149338 ecs_strbuf_t *buf,
49322- const ecs_iter_to_json_desc_t *desc)
49339+ const ecs_iter_to_json_desc_t *desc,
49340+ bool *result_out)
4932349341{
49324- bool result = false;
49342+ *result_out = false;
4932549343 ecs_strbuf_list_push(buf, "", ",");
49326- result |= flecs_json_serialize_table_tags(world, table, NULL, buf, desc);
49327- result |= flecs_json_serialize_table_pairs(world, table, NULL, row, buf, desc);
49328- result |= flecs_json_serialize_vars(world, it, buf, desc);
49344+ *result_out |= flecs_json_serialize_table_tags(world, table, NULL, buf, desc);
49345+ *result_out |= flecs_json_serialize_table_pairs(world, table, NULL, row, buf, desc);
49346+ *result_out |= flecs_json_serialize_vars(world, it, buf, desc);
49347+
4932949348 if (desc->serialize_inherited) {
49330- result |= flecs_json_serialize_table_inherited(world, table, buf, desc);
49349+ if (flecs_json_serialize_table_inherited(
49350+ world, table, buf, desc, result_out))
49351+ {
49352+ return -1;
49353+ }
4933149354 }
4933249355
4933349356 if (desc->serialize_type_info) {
4933449357 /* If we're serializing tables and are requesting type info, it must be
4933549358 * added to each result. */
49336- result |= flecs_json_serialize_table_type_info(world, table, buf, desc);
49359+ *result_out |= flecs_json_serialize_table_type_info(world, table, buf, desc);
4933749360 }
4933849361
4933949362 ecs_strbuf_list_pop(buf, "");
49340- if (!result ) {
49363+ if (!*result_out ) {
4934149364 ecs_strbuf_reset(buf);
4934249365 }
49343- return result;
49366+
49367+ return 0;
4934449368}
4934549369
4934649370int flecs_json_serialize_iter_result_table(
@@ -49363,9 +49387,14 @@ int flecs_json_serialize_iter_result_table(
4936349387 int32_t tags_pairs_vars_len = 0;
4936449388 char *tags_pairs_vars = NULL;
4936549389
49390+ bool has_tags_pairs_vars = false;
4936649391 if (flecs_json_serialize_table_tags_pairs_vars(
49367- world, it, table, 0, &tags_pairs_vars_buf, desc))
49392+ world, it, table, 0, &tags_pairs_vars_buf, desc, &has_tags_pairs_vars ))
4936849393 {
49394+ return -1;
49395+ }
49396+
49397+ if (has_tags_pairs_vars) {
4936949398 tags_pairs_vars_len = ecs_strbuf_written(&tags_pairs_vars_buf);
4937049399 tags_pairs_vars = ecs_strbuf_get(&tags_pairs_vars_buf);
4937149400 }
@@ -55863,7 +55892,7 @@ int flecs_meta_serialize_type(
5586355892 const EcsType *ptr = ecs_get(world, type, EcsType);
5586455893 if (!ptr) {
5586555894 char *path = ecs_get_path(world, type);
55866- ecs_err("missing EcsType for type %s'", path);
55895+ ecs_err("missing reflection data for type ' %s'", path);
5586755896 ecs_os_free(path);
5586855897 return -1;
5586955898 }
@@ -55895,7 +55924,7 @@ void flecs_meta_type_serializer_init(
5589555924 const EcsType *type_ptr = ecs_get(world, type, EcsType);
5589655925 if (!type_ptr) {
5589755926 char *path = ecs_get_path(world, type);
55898- ecs_err("missing EcsType for type %s'", path);
55927+ ecs_err("missing reflection data for type ' %s'", path);
5589955928 ecs_os_free(path);
5590055929 continue;
5590155930 }
@@ -67690,6 +67719,11 @@ ecs_table_memory_t ecs_table_memory_get(
6769067719
6769167720 result.count = count;
6769267721
67722+ flecs_sparse_memory_get(tables, ECS_SIZEOF(ecs_table_t),
67723+ &result.bytes_table,
67724+ &result.bytes_table_overhead,
67725+ &result.bytes_table_overhead);
67726+
6769367727 for (i = 0; i < count; i++) {
6769467728 ecs_table_t *table = flecs_sparse_get_dense_t(tables, ecs_table_t, i);
6769567729 ecs_assert(table != NULL, ECS_INVALID_PARAMETER, NULL);
@@ -67701,7 +67735,6 @@ ecs_table_memory_t ecs_table_memory_get(
6770167735
6770267736 result.column_count += column_count;
6770367737
67704- /* Populate entity count histogram using power-of-2 buckets */
6770567738 if (entity_count == 0) {
6770667739 result.empty_count++;
6770767740 }
@@ -67995,6 +68028,7 @@ void flecs_stats_memory_register_reflection(
6799568028 { .name = "empty_count", .type = ecs_id(ecs_i32_t) },
6799668029 { .name = "column_count", .type = ecs_id(ecs_i32_t) },
6799768030 { .name = "bytes_table", .type = ecs_id(ecs_i32_t), .unit = unit },
68031+ { .name = "bytes_table_overhead", .type = ecs_id(ecs_i32_t), .unit = unit },
6799868032 { .name = "bytes_type", .type = ecs_id(ecs_i32_t), .unit = unit },
6799968033 { .name = "bytes_entities", .type = ecs_id(ecs_i32_t), .unit = unit },
6800068034 { .name = "bytes_overrides", .type = ecs_id(ecs_i32_t), .unit = unit },
0 commit comments