diff options
author | Thomas Haller <thaller@redhat.com> | 2019-08-02 09:37:46 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-08-02 09:37:46 +0200 |
commit | 8fb954b81d6f6ebc5f0b4fda3efa6f02f4c06e8a (patch) | |
tree | 28aa8613fc4047d242012798cab4b2b91d444dcf /shared | |
parent | d76df4c1398324170f306fc3f28b7910d6972ccc (diff) | |
download | NetworkManager-th/coverity.tar.gz |
shared: refactor nm_utils_g_slist_strlist_cmp() to avoid dead-code warning from Coverityth/coverity
Coverity sees that "return 0" cannot be reached. Refactor the code,
to avoid the warning.
Diffstat (limited to 'shared')
-rw-r--r-- | shared/nm-glib-aux/nm-shared-utils.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/shared/nm-glib-aux/nm-shared-utils.c b/shared/nm-glib-aux/nm-shared-utils.c index 33749d3a1c..9bfd5ae2b8 100644 --- a/shared/nm-glib-aux/nm-shared-utils.c +++ b/shared/nm-glib-aux/nm-shared-utils.c @@ -2834,10 +2834,15 @@ nm_utils_g_slist_find_str (const GSList *list, int nm_utils_g_slist_strlist_cmp (const GSList *a, const GSList *b) { - for (; a && b; a = a->next, b = b->next) + while (TRUE) { + if (!a) + return !b ? 0 : -1; + if (!b) + return 1; NM_CMP_DIRECT_STRCMP0 (a->data, b->data); - NM_CMP_SELF (a, b); - return 0; + a = a->next; + b = b->next; + } } /*****************************************************************************/ |