Skip to content

Commit

Permalink
Merge pull request #639 from mtomaschewski/null-cmp-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mtomaschewski committed Apr 13, 2016
2 parents d85458f + c9b08c5 commit 0ddf5e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions include/wicked/util.h
Expand Up @@ -279,7 +279,7 @@ static inline int
ni_string_cmp(const char *a, const char *b)
{
if (a == NULL || b == NULL)
return a > b ? 1 : -1;
return a > b ? 1 : a < b ? -1 : 0;
else
return strcmp(a, b);
}
Expand All @@ -288,7 +288,7 @@ static inline int
ni_string_cmp_nocase(const char *a, const char *b)
{
if (a == NULL || b == NULL)
return a > b ? 1 : -1;
return a > b ? 1 : a < b ? -1 : 0;
else
return strcasecmp(a, b);
}
Expand Down
2 changes: 1 addition & 1 deletion src/util.c
Expand Up @@ -323,7 +323,7 @@ ni_string_array_cmp(const ni_string_array_t *la, const ni_string_array_t *ra)
int ret;

if (!la || !ra)
return la > ra ? 1 : -1;
return la > ra ? 1 : la < ra ? -1 : 0;

if (la->count != ra->count)
return la->count > ra->count ? 1 : -1;
Expand Down

0 comments on commit 0ddf5e0

Please sign in to comment.