/* register an init function */
void ec_init_register(struct ec_init *init)
{
+ struct ec_init *cur;
+
+ if (TAILQ_EMPTY(&init_list)) {
+ TAILQ_INSERT_HEAD(&init_list, init, next);
+ return;
+ }
+
+
+ TAILQ_FOREACH(cur, &init_list, next) {
+ if (init->priority > cur->priority)
+ continue;
+
+ TAILQ_INSERT_BEFORE(cur, init, next);
+ return;
+ }
+
TAILQ_INSERT_TAIL(&init_list, init, next);
}
{
struct ec_init *init;
- /* XXX sort list by priority */
-
TAILQ_FOREACH(init, &init_list, next) {
if (init->init() < 0)
return -1;
static struct ec_init ec_malloc_init = {
.init = ec_malloc_init_func,
- .priority = 50,
+ .priority = 40,
};
EC_INIT_REGISTER(ec_malloc_init);
while (!TAILQ_EMPTY(&parsed->children)) {
child = TAILQ_FIRST(&parsed->children);
TAILQ_REMOVE(&parsed->children, child, next);
+ child->parent = NULL;
ec_parsed_free(child);
}
}
if (parsed == NULL)
return;
- // assert(parsed->parent == NULL); XXX
- // or
- // parsed = ec_parsed_get_root(parsed);
+ ec_assert_print(parsed->parent == NULL,
+ "parent not NULL in ec_parsed_free()");
ec_parsed_free_children(parsed);
ec_strvec_free(parsed->strvec);