aboutsummaryrefslogtreecommitdiff
path: root/src/comp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/comp.c')
-rw-r--r--src/comp.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/comp.c b/src/comp.c
index 539db93..5613e28 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -45,22 +45,20 @@ prev_index (void)
}
void
-component_link (struct component *comp, struct component *ref, int before)
+component_link (struct component *comp, struct component *ref)
{
if (!ref)
{
struct complist *list = &comp_list[comp->listidx];
- comp->next = NULL;
- comp->prev = list->tail;
- if (list->tail)
- list->tail->next = comp;
+ comp->prev = NULL;
+ comp->next = list->head;
+ if (list->head)
+ list->head->prev = comp;
else
- list->head = comp;
- list->tail = comp;
+ list->tail = comp;
+ list->head = comp;
}
- else if (before)
- component_link (comp, ref->prev, 0);
else
{
struct complist *list = &comp_list[comp->listidx];
@@ -81,6 +79,12 @@ component_link (struct component *comp, struct component *ref, int before)
}
void
+component_append (struct component *comp)
+{
+ component_link (comp, comp_list[comp->listidx].tail);
+}
+
+void
component_unlink (struct component *comp)
{
struct complist *list = &comp_list[comp->listidx];
@@ -132,7 +136,7 @@ component_create (const char *name)
comp->redir[RETR_OUT].type = comp->redir[RETR_ERR].type = redir_null;
comp->tag = grecs_strdup (name);
comp->socket_type = SOCK_STREAM;
- component_link (comp, NULL, 0);
+ component_append (comp);
}
return comp;
}
@@ -164,7 +168,6 @@ component_free (struct component *comp)
pies_privs_free (&comp->privs);
free (comp->runlevels);
free_limits (comp->limits);
- free (comp->runlevels);
free (comp->service);
pies_url_destroy (&comp->socket_url);
free (comp->pass_fd_socket);
@@ -487,7 +490,7 @@ component_config_commit (void)
component_merge (match, comp);
component_unlink (match);
match->listidx = cur;
- component_link (match, comp, 1);
+ component_link (match, comp->prev);
component_free (comp);
comp = match;
}

Return to:

Send suggestions and report system problems to the System administrator.