diff options
author | Thomas Haller <thaller@redhat.com> | 2018-04-26 10:46:01 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-05-14 17:53:03 +0200 |
commit | bb649fc3cd2d0dee32241ab603509593335d36bf (patch) | |
tree | 260d5647ee9f426edf40f24ce4a6500ff299728b | |
parent | 8d5febbb381072f6e9b522d938f57f390085545c (diff) | |
download | NetworkManager-bb649fc3cd2d0dee32241ab603509593335d36bf.tar.gz |
shared: add nm_utf8_collate0() helper
Like g_utf8_collate(), which complains about NULL strings.
-rw-r--r-- | shared/nm-utils/nm-shared-utils.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-shared-utils.h b/shared/nm-utils/nm-shared-utils.h index 9486b7b71e..cd535097ec 100644 --- a/shared/nm-utils/nm-shared-utils.h +++ b/shared/nm-utils/nm-shared-utils.h @@ -449,6 +449,16 @@ nm_g_variant_unref_floating (GVariant *var) /*****************************************************************************/ +static inline int +nm_utf8_collate0 (const char *a, const char *b) +{ + if (!a) + return !b ? 0 : -1; + if (!b) + return 1; + return g_utf8_collate (a, b); +} + int nm_strcmp_p_with_data (gconstpointer a, gconstpointer b, gpointer user_data); int nm_cmp_uint32_p_with_data (gconstpointer p_a, gconstpointer p_b, gpointer user_data); int nm_cmp_int2ptr_p_with_data (gconstpointer p_a, gconstpointer p_b, gpointer user_data); |