--- xconf.c.orig 2008-05-23 18:44:40 +0300 +++ xconf.c 2008-06-04 19:27:43 +0300 @@ -50,8 +50,12 @@ XtFree(p->x); \ p->x=XtNewString(""); +#define MergeLists(type, head, tail) \ + head = (type) xf86addListItem((GenericListPtr) (head), (GenericListPtr) (tail)) + #define AddListItem(type, head, new) \ - head = (type) xf86addListItem((GenericListPtr) (head), (GenericListPtr) (new)); + (new)->list.next = NULL; \ + MergeLists(type, head, new) #define LoadList conf->conf_modules->mod_load_lst @@ -73,7 +77,7 @@ int f = 0; if (LoadList != DisableList) - AddListItem(XF86LoadPtr, LoadList, DisableList); + MergeLists(XF86LoadPtr, LoadList, DisableList); for (l = LoadList; l != NULL; l = l->list.next) if ((l->load_opt == NULL) && (strcmp(l->load_name, module) == 0)) { @@ -89,7 +93,6 @@ { l->load_name = (char*) module; l->load_opt = NULL; - l->list.next = NULL; l->load_type = out; l->load_comment = NULL; l->ignore = 0; @@ -428,8 +431,7 @@ { XF86ModePtr mode = calloc(1, sizeof(XF86ModeRec)); mode->mode_name = XtNewString(res_parse); - mode->list.next = disp->disp_mode_lst; - disp->disp_mode_lst = mode; + AddListItem(XF86ModePtr, disp->disp_mode_lst, mode); } res_parse = next_pos; @@ -507,7 +509,6 @@ if (action != NULL) { - action->list.next = NULL; action->type = a; action->arg = (char*) arg; return AddListItem(ActionPtr, actions, action);