350
351
352
353
354
355
356
357
358
359
360
361
362
363
|
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
if (!resize(map, map->items))
return false;
}
return true;
}
void
cfw_map_iter(CFWMap *map, cfw_map_iter_t *iter)
{
iter->key = NULL;
iter->obj = NULL;
iter->_map = map;
iter->_pos = 0;
}
void
cfw_map_iter_next(cfw_map_iter_t *iter)
{
CFWMap *map = iter->_map;
for (; iter->_pos < map->size &&
(map->data[iter->_pos] == NULL ||
map->data[iter->_pos] == &deleted); iter->_pos++);
if (iter->_pos < map->size) {
iter->key = map->data[iter->_pos]->key;
iter->obj = map->data[iter->_pos]->obj;
iter->_pos++;
} else {
iter->key = NULL;
iter->obj = NULL;
}
}
static CFWClass class = {
.name = "CFWMap",
.size = sizeof(CFWMap),
.ctor = ctor,
.dtor = dtor,
.equal = equal,
|