init: code shrink -4 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2011-12-05 03:54:28 +01:00
parent beb860ac75
commit ef7aa46bc4

View File

@ -598,7 +598,7 @@ static void new_init_action(uint8_t action_type, const char *command, const char
*/ */
nextp = &init_action_list; nextp = &init_action_list;
while ((a = *nextp) != NULL) { while ((a = *nextp) != NULL) {
/* Don't enter action if it's already in the list, /* Don't enter action if it's already in the list.
* This prevents losing running RESPAWNs. * This prevents losing running RESPAWNs.
*/ */
if (strcmp(a->command, command) == 0 if (strcmp(a->command, command) == 0
@ -610,14 +610,15 @@ static void new_init_action(uint8_t action_type, const char *command, const char
while (*nextp != NULL) while (*nextp != NULL)
nextp = &(*nextp)->next; nextp = &(*nextp)->next;
a->next = NULL; a->next = NULL;
break; goto append;
} }
nextp = &a->next; nextp = &a->next;
} }
if (!a)
a = xzalloc(sizeof(*a)); a = xzalloc(sizeof(*a));
/* Append to the end of the list */ /* Append to the end of the list */
append:
*nextp = a; *nextp = a;
a->action_type = action_type; a->action_type = action_type;
safe_strncpy(a->command, command, sizeof(a->command)); safe_strncpy(a->command, command, sizeof(a->command));