summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-04-26 10:46:01 +0200
committerThomas Haller <thaller@redhat.com>2018-05-14 17:53:03 +0200
commitbb649fc3cd2d0dee32241ab603509593335d36bf (patch)
tree260d5647ee9f426edf40f24ce4a6500ff299728b
parent8d5febbb381072f6e9b522d938f57f390085545c (diff)
downloadNetworkManager-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.h10
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);