From 3d2fa6d23323e954b97757bc7e7397f39f039f1a Mon Sep 17 00:00:00 2001 From: Gareth McMullin Date: Mon, 27 Mar 2017 14:54:41 +1300 Subject: [PATCH] target: Add new targets to end of list. This shows targets enumerated in their natural order, rather than in reverse. --- src/target/target.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/target/target.c b/src/target/target.c index 0737eb25..fe11079c 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -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; }