From 01200282da3d4a06885eff34de1678a9da47d2f2 Mon Sep 17 00:00:00 2001 From: Manish Singh Date: Sat, 31 Jan 1998 08:15:57 +0000 Subject: [PATCH] Added and autoconfigured in a new utility function g_strcasecmp GtkCombo uses g_strcasecmp now Quelled a warning about atexit undeclared in gtkobject -Yosh --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ glib/ChangeLog | 5 +++++ glib/configure.in | 4 ++-- glib/glib.h | 13 +++++++------ glib/glibconfig.h.in | 3 +++ glib/gutils.c | 19 +++++++++++++++++++ gtk/gtkcombo.c | 2 +- gtk/gtkobject.c | 1 + 14 files changed, 73 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ec9ff0bbe0..08cd96220d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Jan 31 00:05:34 PST 1998 Manish Singh + + * gtk/gtkcombo.c: changed to use g_strcasecmp + * gtk/gtkobject.c: #include for atexit + Sat Jan 31 00:13:33 1998 Owen Taylor * gtk/gtkstyle.c: Backed out change to close polygons diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index ec9ff0bbe0..08cd96220d 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Sat Jan 31 00:05:34 PST 1998 Manish Singh + + * gtk/gtkcombo.c: changed to use g_strcasecmp + * gtk/gtkobject.c: #include for atexit + Sat Jan 31 00:13:33 1998 Owen Taylor * gtk/gtkstyle.c: Backed out change to close polygons diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index ec9ff0bbe0..08cd96220d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Sat Jan 31 00:05:34 PST 1998 Manish Singh + + * gtk/gtkcombo.c: changed to use g_strcasecmp + * gtk/gtkobject.c: #include for atexit + Sat Jan 31 00:13:33 1998 Owen Taylor * gtk/gtkstyle.c: Backed out change to close polygons diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index ec9ff0bbe0..08cd96220d 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Sat Jan 31 00:05:34 PST 1998 Manish Singh + + * gtk/gtkcombo.c: changed to use g_strcasecmp + * gtk/gtkobject.c: #include for atexit + Sat Jan 31 00:13:33 1998 Owen Taylor * gtk/gtkstyle.c: Backed out change to close polygons diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index ec9ff0bbe0..08cd96220d 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Sat Jan 31 00:05:34 PST 1998 Manish Singh + + * gtk/gtkcombo.c: changed to use g_strcasecmp + * gtk/gtkobject.c: #include for atexit + Sat Jan 31 00:13:33 1998 Owen Taylor * gtk/gtkstyle.c: Backed out change to close polygons diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index ec9ff0bbe0..08cd96220d 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Sat Jan 31 00:05:34 PST 1998 Manish Singh + + * gtk/gtkcombo.c: changed to use g_strcasecmp + * gtk/gtkobject.c: #include for atexit + Sat Jan 31 00:13:33 1998 Owen Taylor * gtk/gtkstyle.c: Backed out change to close polygons diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index ec9ff0bbe0..08cd96220d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Sat Jan 31 00:05:34 PST 1998 Manish Singh + + * gtk/gtkcombo.c: changed to use g_strcasecmp + * gtk/gtkobject.c: #include for atexit + Sat Jan 31 00:13:33 1998 Owen Taylor * gtk/gtkstyle.c: Backed out change to close polygons diff --git a/glib/ChangeLog b/glib/ChangeLog index 5fb90e439a..df0ae96dac 100644 --- a/glib/ChangeLog +++ b/glib/ChangeLog @@ -1,3 +1,8 @@ +Fri Jan 30 23:57:17 PST 1998 Manish Singh + + * added and autoconfigured in a new utility function + g_strcasecmp + Wed Jan 28 23:53:27 PST 1998 Manish Singh * glist.c diff --git a/glib/configure.in b/glib/configure.in index 66da2f0fa4..9df1d3922b 100644 --- a/glib/configure.in +++ b/glib/configure.in @@ -69,8 +69,8 @@ AC_CHECK_HEADERS(float.h, AC_DEFINE(HAVE_FLOAT_H)) AC_CHECK_HEADERS(limits.h, AC_DEFINE(HAVE_LIMITS_H)) AC_CHECK_HEADERS(values.h, AC_DEFINE(HAVE_VALUES_H)) -# Check for strerror, strsignal, and memmove functions -AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf) +# Check for strerror, strsignal, memmove, vsnprintf, and strcasecmp functions +AC_CHECK_FUNCS(strerror strsignal memmove vsnprintf strcasecmp) # Check for sys_errlist AC_MSG_CHECKING(sys_errlist) diff --git a/glib/glib.h b/glib/glib.h index 257d5925ce..32850def1e 100644 --- a/glib/glib.h +++ b/glib/glib.h @@ -625,12 +625,13 @@ void g_print (gchar *format, ...); /* Utility functions */ -gchar* g_strdup (const gchar *str); -gchar* g_strconcat (const gchar *string1, ...); /* NULL terminated */ -gdouble g_strtod (const gchar *nptr, gchar **endptr); -gchar* g_strerror (gint errnum); -gchar* g_strsignal (gint signum); -gint g_snprintf (gchar *str, gulong n, gchar const *fmt, ...); +gchar* g_strdup (const gchar *str); +gchar* g_strconcat (const gchar *string1, ...); /* NULL terminated */ +gdouble g_strtod (const gchar *nptr, gchar **endptr); +gchar* g_strerror (gint errnum); +gchar* g_strsignal (gint signum); +gint g_strcasecmp (const guchar *s1, const guchar *s2); +gint g_snprintf (gchar *str, gulong n, gchar const *fmt, ...); /* We make the assumption that if memmove isn't available, then diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in index ad4a6b08ee..f1b9eacfa4 100644 --- a/glib/glibconfig.h.in +++ b/glib/glibconfig.h.in @@ -65,6 +65,9 @@ /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + /* Define if you have the header file. */ #undef HAVE_FLOAT_H diff --git a/glib/gutils.c b/glib/gutils.c index 87c3964b53..6dd230d4e4 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -842,3 +842,22 @@ g_snprintf (gchar *str, #endif } + +gint +g_strcasecmp (const guchar *s1, const guchar *s2) +{ +#ifdef HAVE_STRCASECMP + return strcasecmp(s1, s2); +#else + gint c1, c2; + + while (*s1 && *s2) + { + c1 = tolower(*s1++); c2 = tolower(*s2++); + if (c1 != c2) + return (c1 - c2); + } + + return ((gint) *s1 - (gint) *s2); +#endif +} diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c index 539985da0e..b2fe20952e 100644 --- a/gtk/gtkcombo.c +++ b/gtk/gtkcombo.c @@ -148,7 +148,7 @@ gtk_combo_find (GtkCombo * combo) if (combo->case_sensitive) string_compare = strcmp; else - string_compare = strcasecmp; + string_compare = g_strcasecmp; text = gtk_entry_get_text (GTK_ENTRY (combo->entry)); clist = GTK_LIST (combo->list)->children; diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c index 07d921f34c..dbfedb276b 100644 --- a/gtk/gtkobject.c +++ b/gtk/gtkobject.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "gtkobject.h" #include "gtksignal.h"