From a08b760d4e167998f554a8ed95f40ee2d01ef518 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 19 Oct 2008 01:52:21 +0200 Subject: [PATCH] Add g_strcmp0 to compat, it's Glib 2.16 --- midori/compat.c | 18 ++++++++++++++++++ midori/compat.h | 8 ++++++++ 2 files changed, 26 insertions(+) diff --git a/midori/compat.c b/midori/compat.c index 7a871ad1..cd6243d5 100644 --- a/midori/compat.c +++ b/midori/compat.c @@ -11,6 +11,24 @@ #include "compat.h" +#if !GLIB_CHECK_VERSION(2, 16, 0) + +/* Glib string function + Copyright (C) 2008 Tim Janik + Copied from Glib 2.16, coding style adjusted */ +gint +g_strcmp0 (const gchar* string1, + const gchar* string2) +{ + if (!string1) + return -(str1 != str2); + if (!string2) + return string1 != string2; + return strcmp (string1, string2); +} + +#endif + #if !GTK_CHECK_VERSION(2, 14, 0) #if HAVE_GIO diff --git a/midori/compat.h b/midori/compat.h index bd03cf97..49cb3e60 100644 --- a/midori/compat.h +++ b/midori/compat.h @@ -23,6 +23,14 @@ G_BEGIN_DECLS +#if !GLIB_CHECK_VERSION(2, 16, 0) + +gint +g_strcmp0 (const gchar* string1, + const gchar* string2); + +#endif + #if !GTK_CHECK_VERSION(2, 14, 0) #if HAVE_GIO