g_strcmp0 first occures in GLIB 2.16 define it localy if it does not exist

to make builds on Fedora 8 with GTK 2.12 work.

svn path=/trunk/; revision=45707
This commit is contained in:
Anders Broman 2012-10-22 12:20:36 +00:00
parent 0c0cec7e69
commit e9f13d771c
3 changed files with 38 additions and 0 deletions

View File

@ -1084,3 +1084,32 @@ gchar *string_replace(const gchar* str, const gchar *old_val, const gchar *new_v
return new_str;
}
/**
* g_strcmp0 appears first in GLIB 2.16, define it locally for earlier versions.
* Copied from gtestutils.c in glib
* g_strcmp0:
* @str1: (allow-none): a C string or %NULL
* @str2: (allow-none): another C string or %NULL
*
* Compares @str1 and @str2 like strcmp(). Handles %NULL
* gracefully by sorting it before non-%NULL strings.
* Comparing two %NULL pointers returns 0.
*
* Returns: -1, 0 or 1, if @str1 is <, == or > than @str2.
*
* Since: 2.16
*/
#if !GLIB_CHECK_VERSION(2,16,0)
int
g_strcmp0 (const char *str1,
const char *str2)
{
if (!str1)
return -(str1 != str2);
if (!str2)
return str1 != str2;
return strcmp (str1, str2);
}
#endif /* GLIB_CHECK_VERSION(2,16,0) */

View File

@ -272,6 +272,14 @@ gchar* ws_strdup_unescape_char (const gchar *str, const gchar chr);
*/
gchar *string_replace(const gchar* str, const gchar *old_val, const gchar *new_val);
/**
* g_strcmp0 appears first in GLIB 2.16, define it locally for earlier versions.
*/
#if !GLIB_CHECK_VERSION(2,16,0)
int g_strcmp0 (const char *str1,
const char *str2);
#endif /* GLIB_CHECK_VERSION(2,16,0) */
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -54,6 +54,7 @@
#include "globals.h"
#include <epan/filesystem.h>
#include <epan/strutil.h>
#include "fileset.h"