From: Matthias Clasen Date: Tue, 4 Oct 2011 03:54:08 +0000 (-0400) Subject: Remove bits of dead code identified by coverage tests X-Git-Tag: 2.31.0~276 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fe4429318b147f275e730ef5a69cb94a0a25062;p=platform%2Fupstream%2Fglib.git Remove bits of dead code identified by coverage tests These lines could were not hit by our tests, and examination of the code reveals that they can't ever be hit. --- diff --git a/glib/glist.c b/glib/glist.c index f75e2af..91794d9 100644 --- a/glib/glist.c +++ b/glib/glist.c @@ -310,28 +310,24 @@ g_list_insert (GList *list, { GList *new_list; GList *tmp_list; - + if (position < 0) return g_list_append (list, data); else if (position == 0) return g_list_prepend (list, data); - + tmp_list = g_list_nth (list, position); if (!tmp_list) return g_list_append (list, data); - + new_list = _g_list_alloc (); new_list->data = data; new_list->prev = tmp_list->prev; - if (tmp_list->prev) - tmp_list->prev->next = new_list; + tmp_list->prev->next = new_list; new_list->next = tmp_list; tmp_list->prev = new_list; - - if (tmp_list == list) - return new_list; - else - return list; + + return list; } /** diff --git a/glib/gslist.c b/glib/gslist.c index 6a11669..e99971e 100644 --- a/glib/gslist.c +++ b/glib/gslist.c @@ -316,16 +316,8 @@ g_slist_insert (GSList *list, tmp_list = tmp_list->next; } - if (prev_list) - { - new_list->next = prev_list->next; - prev_list->next = new_list; - } - else - { - new_list->next = list; - list = new_list; - } + new_list->next = prev_list->next; + prev_list->next = new_list; return list; }