return 1;
}
} else if (ci->cls == CC_LIST) {
- struct cnode *n;
uns idx = 0;
- CLIST_WALK(n, * (clist*) (ptr + (addr_int_t) ci->ptr))
+ CLIST_FOR_EACH(cnode *, n, * (clist*) (ptr + (addr_int_t) ci->ptr))
if (idx++, commit_section(ci->name, ci->u.sec, n, commit_all)) {
log(L_ERROR, "It happened in node #%d of list %s", idx, ci->name);
return 1;
}
static void
-add_to_list(struct cnode *where, struct cnode *new_node, enum cf_operation op)
+add_to_list(cnode *where, cnode *new_node, enum cf_operation op)
{
switch (op)
{
case OP_EDIT: // edition has been done in-place
break;
case OP_REMOVE:
- cf_journal_block(&where->prev->next, sizeof(void*));
- cf_journal_block(&where->next->prev, sizeof(void*));
+ CF_JOURNAL_VAR(where->prev->next);
+ CF_JOURNAL_VAR(where->next->prev);
clist_remove(where);
break;
case OP_AFTER: // implementation dependend (prepend_head = after(list)), and where==list, see clists.h:74
case OP_PREPEND:
case OP_COPY:
- cf_journal_block(&where->next->prev, sizeof(void*));
- cf_journal_block(&where->next, sizeof(void*));
+ CF_JOURNAL_VAR(where->next->prev);
+ CF_JOURNAL_VAR(where->next);
clist_insert_after(new_node, where);
break;
case OP_BEFORE: // implementation dependend (append_tail = before(list))
case OP_APPEND:
case OP_SET:
- cf_journal_block(&where->prev->next, sizeof(void*));
- cf_journal_block(&where->prev, sizeof(void*));
+ CF_JOURNAL_VAR(where->prev->next);
+ CF_JOURNAL_VAR(where->prev);
clist_insert_before(new_node, where);
break;
default:
interpret_clear(struct cf_item *item, void *ptr)
{
if (item->cls == CC_LIST) {
- cf_journal_block(ptr, sizeof(struct clist));
+ cf_journal_block(ptr, sizeof(clist));
clist_init(ptr);
} else if (item->cls == CC_DYNAMIC) {
cf_journal_block(ptr, sizeof(void *));
}
static void *
-find_list_node(struct clist *list, void *query, struct cf_section *sec, u32 mask)
+find_list_node(clist *list, void *query, struct cf_section *sec, u32 mask)
{
- struct cnode *n;
- CLIST_WALK(n, *list)
+ CLIST_FOR_EACH(cnode *, n, *list)
{
uns found = 1;
for (uns i=0; i<32; i++)
dump_section(fb, item->u.sec, level+1, ptr);
else if (item->cls == CC_LIST) {
uns idx = 0;
- struct cnode *n;
- CLIST_WALK(n, * (clist*) ptr) {
+ CLIST_FOR_EACH(cnode *, n, * (clist*) ptr) {
spaces(fb, level+1);
bprintf(fb, "item %d\n", ++idx);
dump_section(fb, item->u.sec, level+2, n);
#define CF_ITEMS .cfg = ( struct cf_item[] )
#define CF_END { .cls = CC_END }
/* Configuration items */
-struct clist;
#define CF_STATIC(n,p,T,t,c) { .cls = CC_STATIC, .type = CT_##T, .name = n, .number = c, .ptr = CHECK_PTR_TYPE(p,t*) }
#define CF_DYNAMIC(n,p,T,t,c) { .cls = CC_DYNAMIC, .type = CT_##T, .name = n, .number = c, .ptr = CHECK_PTR_TYPE(p,t**) }
#define CF_PARSER(n,p,f,c) { .cls = CC_PARSER, .name = n, .number = c, .ptr = p, .u.par = (cf_parser*) f }
#define CF_SECTION(n,p,s) { .cls = CC_SECTION, .name = n, .number = 1, .ptr = p, .u.sec = s }
-#define CF_LIST(n,p,s) { .cls = CC_LIST, .name = n, .number = 1, .ptr = CHECK_PTR_TYPE(p,struct clist*), .u.sec = s }
+#define CF_LIST(n,p,s) { .cls = CC_LIST, .name = n, .number = 1, .ptr = CHECK_PTR_TYPE(p,clist*), .u.sec = s }
/* Configuration items for basic types */
#define CF_INT(n,p) CF_STATIC(n,p,INT,int,1)
#define CF_INT_ARY(n,p,c) CF_STATIC(n,p,INT,int,c)