Minor cleanup and perf improvement

This commit is contained in:
2022-12-03 15:31:02 -05:00
parent 0d3a8c5f8b
commit 24f1688e9a
2 changed files with 2 additions and 5 deletions

View File

@@ -73,8 +73,6 @@ void *ucl_arena_get(struct ucl_arena *arena) {
return NULL; return NULL;
} }
int total_arena_puts = 0;
void ucl_arena_put(struct ucl_arena *arena, void *object) { void ucl_arena_put(struct ucl_arena *arena, void *object) {
if (object == NULL) { if (object == NULL) {
return; return;
@@ -87,9 +85,7 @@ void ucl_arena_put(struct ucl_arena *arena, void *object) {
assert(offset % arena->object_size == 0); assert(offset % arena->object_size == 0);
assert(index < arena->capacity); assert(index < arena->capacity);
assert(arena->used_map[int_index] & (1 << bit_index)); assert(arena->used_map[int_index] & (1 << bit_index));
total_arena_puts++;
arena->used_map[int_index] &= ~(1 << bit_index); arena->used_map[int_index] &= ~(1 << bit_index);

View File

@@ -40,7 +40,8 @@ struct ucl_object *ucl_scope_get(struct ucl *state, struct ucl_scope *scope, con
scope = scope->parent; scope = scope->parent;
cell = ucl_scope_get_cell(scope, name); cell = ucl_scope_get_cell(scope, name);
} }
return ucl_list_nth(cell, DATA_POSITION); // This code is a little hot. No error checking.
return cell->cell.cdr->cell.car;
} }
void ucl_scope_put(struct ucl *state, struct ucl_scope *scope, const char *name, struct ucl_object *obj) { void ucl_scope_put(struct ucl *state, struct ucl_scope *scope, const char *name, struct ucl_object *obj) {