void ctable_to_array(CTable *table, zval *array)
{
if (table->size == 0) {
array_init(array);
} else {
CBucket *it, *end;
sort_table(table);
it = table->buckets;
end = it + table->size;
array_init_size(array, table->size);
for (; it < end; it++) {
zval obj;
object_init_ex(&obj, counted_pair_ce);
/* copy value */
add_next_index_zval(array, &obj);
}
}
}