target: Add new targets to end of list.

This shows targets enumerated in their natural order,
rather than in reverse.
This commit is contained in:
Gareth McMullin 2017-03-27 14:54:41 +13:00
parent a0791f9525
commit 3d2fa6d233
1 changed files with 8 additions and 2 deletions

View File

@ -29,8 +29,14 @@ target *target_list = NULL;
target *target_new(void)
{
target *t = (void*)calloc(1, sizeof(*t));
t->next = target_list;
target_list = t;
if (target_list) {
target *c = target_list;
while (c->next)
c = c->next;
c->next = t;
} else {
target_list = t;
}
return t;
}