Use correct TAILQ_CONCAT macro when not defined.

This commit is contained in:
Roy Marples 2008-03-16 17:27:13 +00:00
parent 1fd1472dde
commit 40930d7d0a
6 changed files with 15 additions and 14 deletions

View File

@ -111,9 +111,10 @@
#endif #endif
#ifndef TAILQ_CONCAT #ifndef TAILQ_CONCAT
#define TAILQ_CONCAT(head1, head2) do { \ #define TAILQ_CONCAT(head1, head2, field) do { \
if (!TAILQ_EMPTY((head2))) { \ if (!TAILQ_EMPTY(head2)) { \
*(head1)->tqh_last = (head2)->tqh_first; \ *(head1)->tqh_last = (head2)->tqh_first; \
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
(head1)->tqh_last = (head2)->tqh_last; \ (head1)->tqh_last = (head2)->tqh_last; \
TAILQ_INIT((head2)); \ TAILQ_INIT((head2)); \
} \ } \

View File

@ -522,24 +522,24 @@ RC_STRINGLIST *rc_deptree_order(const RC_DEPTREE *deptree,
list = rc_services_in_state(RC_SERVICE_STARTED); list = rc_services_in_state(RC_SERVICE_STARTED);
list2 = rc_services_in_state (RC_SERVICE_INACTIVE); list2 = rc_services_in_state (RC_SERVICE_INACTIVE);
TAILQ_CONCAT(list, list2); TAILQ_CONCAT(list, list2, entries);
free(list2); free(list2);
list2 = rc_services_in_state (RC_SERVICE_STARTING); list2 = rc_services_in_state (RC_SERVICE_STARTING);
TAILQ_CONCAT(list, list2); TAILQ_CONCAT(list, list2, entries);
free(list2); free(list2);
} else { } else {
list = rc_services_in_runlevel (runlevel); list = rc_services_in_runlevel (runlevel);
/* Add coldplugged services */ /* Add coldplugged services */
list2 = rc_services_in_state (RC_SERVICE_COLDPLUGGED); list2 = rc_services_in_state (RC_SERVICE_COLDPLUGGED);
TAILQ_CONCAT(list, list2); TAILQ_CONCAT(list, list2, entries);
free(list2); free(list2);
/* If we're not the boot runlevel then add that too */ /* If we're not the boot runlevel then add that too */
if (strcmp (runlevel, bootlevel) != 0) { if (strcmp (runlevel, bootlevel) != 0) {
list2 = rc_services_in_runlevel (bootlevel); list2 = rc_services_in_runlevel (bootlevel);
TAILQ_CONCAT(list, list2); TAILQ_CONCAT(list, list2, entries);
free(list2); free(list2);
} }
} }

View File

@ -839,13 +839,13 @@ RC_STRINGLIST *rc_services_in_runlevel(const char *runlevel)
#ifdef RC_PKG_INITDIR #ifdef RC_PKG_INITDIR
if (pkg) { if (pkg) {
TAILQ_CONCAT(list, pkg); TAILQ_CONCAT(list, pkg, entries);
free(pkg); free(pkg);
} }
#endif #endif
#ifdef RC_LOCAL_DIR #ifdef RC_LOCAL_DIR
if (local) { if (local) {
TAILQ_CONCAT(list, local); TAILQ_CONCAT(list, local, entries);
free(local); free(local);
} }
#endif #endif
@ -883,7 +883,7 @@ RC_STRINGLIST *rc_services_in_state(RC_SERVICE state)
p = rc_strcatpaths(dir, d->value, (char *) NULL); p = rc_strcatpaths(dir, d->value, (char *) NULL);
services = ls_dir(p, LS_INITD); services = ls_dir(p, LS_INITD);
free(p); free(p);
TAILQ_CONCAT(list, services); TAILQ_CONCAT(list, services, entries);
free(services); free(services);
} }
rc_stringlist_free(dirs); rc_stringlist_free(dirs);

View File

@ -79,7 +79,7 @@ char *rc_conf_value(const char *setting)
if (exists(RC_CONF_OLD)) { if (exists(RC_CONF_OLD)) {
old = rc_config_load(RC_CONF_OLD); old = rc_config_load(RC_CONF_OLD);
if (old) { if (old) {
TAILQ_CONCAT(rc_conf, old); TAILQ_CONCAT(rc_conf, old, entries);
free(old); free(old);
} }
} }

View File

@ -951,10 +951,10 @@ int main(int argc, char **argv)
* correct order for stopping them */ * correct order for stopping them */
stop_services = rc_services_in_state(RC_SERVICE_STARTED); stop_services = rc_services_in_state(RC_SERVICE_STARTED);
tmplist = rc_services_in_state(RC_SERVICE_INACTIVE); tmplist = rc_services_in_state(RC_SERVICE_INACTIVE);
TAILQ_CONCAT(stop_services, tmplist); TAILQ_CONCAT(stop_services, tmplist, entries);
free(tmplist); free(tmplist);
tmplist = rc_services_in_state(RC_SERVICE_STARTING); tmplist = rc_services_in_state(RC_SERVICE_STARTING);
TAILQ_CONCAT(stop_services, tmplist); TAILQ_CONCAT(stop_services, tmplist, entries);
free(tmplist); free(tmplist);
rc_stringlist_sort(&stop_services); rc_stringlist_sort(&stop_services);
@ -981,7 +981,7 @@ int main(int argc, char **argv)
start_services = rc_services_in_runlevel(bootlevel); start_services = rc_services_in_runlevel(bootlevel);
if (strcmp (newlevel ? newlevel : runlevel, bootlevel) != 0) { if (strcmp (newlevel ? newlevel : runlevel, bootlevel) != 0) {
tmplist = rc_services_in_runlevel(newlevel ? newlevel : runlevel); tmplist = rc_services_in_runlevel(newlevel ? newlevel : runlevel);
TAILQ_CONCAT(start_services, tmplist); TAILQ_CONCAT(start_services, tmplist, entries);
free(tmplist); free(tmplist);
} }

View File

@ -627,7 +627,7 @@ static void get_started_services(void)
RC_STRINGLIST *tmp = rc_services_in_state(RC_SERVICE_INACTIVE); RC_STRINGLIST *tmp = rc_services_in_state(RC_SERVICE_INACTIVE);
rc_stringlist_free(restart_services); rc_stringlist_free(restart_services);
restart_services = rc_services_in_state(RC_SERVICE_STARTED); restart_services = rc_services_in_state(RC_SERVICE_STARTED);
TAILQ_CONCAT(restart_services, tmp); TAILQ_CONCAT(restart_services, tmp, entries);
free(tmp); free(tmp);
} }