MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / py_param_grow

Function py_param_grow

internal/cbm/extract_unified.c:172–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172static bool py_param_grow(WalkState *state) {
173 int new_capacity = state->py_param_slot_capacity * PAIR_LEN;
174 if (new_capacity <= state->py_param_slot_capacity) {
175 return false;
176 }
177 CBMParamSlot *grown =
178 (CBMParamSlot *)cbm_arena_alloc(state->arena, (size_t)new_capacity * sizeof(*grown));
179 if (!grown) {
180 return false;
181 }
182 memset(grown, 0, (size_t)new_capacity * sizeof(*grown));
183 CBMParamSlot *old = state->py_param_slots;
184 int old_capacity = state->py_param_slot_capacity;
185 state->py_param_slots = grown;
186 state->py_param_slot_capacity = new_capacity;
187 for (int i = 0; i < old_capacity; i++) {
188 if (old[i].hash != 0) {
189 *py_param_slot(state, old[i].name, old[i].hash) = old[i];
190 }
191 }
192 return true;
193}
194
195static bool py_param_stack_reserve(WalkState *state) {
196 if (state->py_param_stack_count < state->py_param_stack_capacity) {

Callers 1

py_param_bindFunction · 0.85

Calls 2

py_param_slotFunction · 0.85
cbm_arena_allocFunction · 0.70

Tested by

no test coverage detected