static void* dyn_array_ptr_pop (DynPtrArray *da) { int size = da->array.size; void *p; g_assert (size > 0); if (da->array.capacity == 1) { p = dyn_array_ptr_get (da, 0); dyn_array_init (&da->array); } else { g_assert (da->array.capacity > 1); dyn_array_ensure_independent (&da->array, sizeof (void*)); p = dyn_array_ptr_get (da, size - 1); --da->array.size; } return p; }
static void* dyn_array_ptr_pop (DynPtrArray *da) { int size = da->array.size; void *p; g_assert (size > 0); #ifdef OPTIMIZATION_SINGLETON_DYN_ARRAY if (da->array.capacity == 1) { p = dyn_array_ptr_get (da, 0); dyn_array_init (&da->array); } else #endif { g_assert (da->array.capacity > 1); dyn_array_ensure_independent (&da->array, sizeof (void*)); p = dyn_array_ptr_get (da, size - 1); --da->array.size; } return p; }
static void dyn_array_int_ensure_independent (DynIntArray *da) { dyn_array_ensure_independent (&da->array, sizeof (int)); }