[gtk+] Use g_strcmp0() instead custom safe_strcmp()
- From: Javier Jardón <jjardon src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Use g_strcmp0() instead custom safe_strcmp()
- Date: Fri, 8 Jan 2010 17:28:06 +0000 (UTC)
commit f5b21802bbf02d89c61633286492f62109b0f2a2
Author: Javier Jardón <jjardon gnome org>
Date: Fri Jan 8 17:42:34 2010 +0100
Use g_strcmp0() instead custom safe_strcmp()
Reported by Rafal Luzynski in
https://bugzilla.gnome.org/show_bug.cgi?id=606415
gtk/gtkprinter.c | 18 +++---------------
gtk/gtkprinteroptionset.c | 13 +------------
2 files changed, 4 insertions(+), 27 deletions(-)
---
diff --git a/gtk/gtkprinter.c b/gtk/gtkprinter.c
index 9ef7dc8..1ffaaf5 100644
--- a/gtk/gtkprinter.c
+++ b/gtk/gtkprinter.c
@@ -92,18 +92,6 @@ static void gtk_printer_get_property (GObject *object,
G_DEFINE_TYPE (GtkPrinter, gtk_printer, G_TYPE_OBJECT)
-static int
-safe_strcmp (const char *a, const char *b)
-{
- if (a == b)
- return 0;
- if (a == NULL)
- return -1;
- if (b == NULL)
- return 1;
- return strcmp (a, b);
-}
-
static void
gtk_printer_class_init (GtkPrinterClass *class)
{
@@ -468,7 +456,7 @@ gtk_printer_set_description (GtkPrinter *printer,
priv = printer->priv;
- if (safe_strcmp (priv->description, description) == 0)
+ if (g_strcmp0 (priv->description, description) == 0)
return FALSE;
g_free (priv->description);
@@ -506,7 +494,7 @@ gtk_printer_set_state_message (GtkPrinter *printer,
priv = printer->priv;
- if (safe_strcmp (priv->state_message, message) == 0)
+ if (g_strcmp0 (priv->state_message, message) == 0)
return FALSE;
g_free (priv->state_message);
@@ -544,7 +532,7 @@ gtk_printer_set_location (GtkPrinter *printer,
priv = printer->priv;
- if (safe_strcmp (priv->location, location) == 0)
+ if (g_strcmp0 (priv->location, location) == 0)
return FALSE;
g_free (priv->location);
diff --git a/gtk/gtkprinteroptionset.c b/gtk/gtkprinteroptionset.c
index 391e5a6..dde9d5b 100644
--- a/gtk/gtkprinteroptionset.c
+++ b/gtk/gtkprinteroptionset.c
@@ -144,17 +144,6 @@ gtk_printer_option_set_clear_conflicts (GtkPrinterOptionSet *set)
NULL);
}
-static int
-safe_strcmp (const char *a, const char *b)
-{
- if (a == NULL)
- a = "";
- if (b == NULL)
- b = "";
-
- return strcmp (a, b);
-}
-
/**
* gtk_printer_option_set_get_groups:
*
@@ -171,7 +160,7 @@ gtk_printer_option_set_get_groups (GtkPrinterOptionSet *set)
{
option = g_ptr_array_index (set->array, i);
- if (g_list_find_custom (list, option->group, (GCompareFunc)safe_strcmp) == NULL)
+ if (g_list_find_custom (list, option->group, (GCompareFunc)g_strcmp0) == NULL)
list = g_list_prepend (list, g_strdup (option->group));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]