Update copyright year to 2014 by running admin/update-copyright.
[bpt/emacs.git] / lwlib / lwlib.c
index d436b18..f3e8016 100644 (file)
@@ -1,7 +1,7 @@
 /* A general interface to the widgets of different toolkits.
 
 Copyright (C) 1992, 1993 Lucid, Inc.
-Copyright (C) 1994-1996, 1999-201 Free Software Foundation, Inc.
+Copyright (C) 1994-1996, 1999-2014 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
@@ -16,18 +16,16 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
 #include <setjmp.h>
 #include <lisp.h>
+#include <c-strcase.h>
 
 #include <sys/types.h>
 #include <stdio.h>
-#include <ctype.h>
 #include "lwlib-int.h"
 #include "lwlib-utils.h"
 #include <X11/StringDefs.h>
@@ -105,37 +103,8 @@ static void show_one_widget_busy (Widget, Boolean);
 char *
 safe_strdup (const char *s)
 {
-  char *result;
-  if (! s) return 0;
-  result = (char *) xmalloc (strlen (s) + 1);
-  strcpy (result, s);
-  return result;
-}
-
-#ifdef HAVE_STRCASECMP
-#define lwlib_strcasecmp(x,y) strcasecmp ((x), (y))
-#else
-
-/* Like strcmp but ignore differences in case.  */
-
-static int
-lwlib_strcasecmp (const char *s1, const char *s2)
-{
-  while (1)
-    {
-      int c1 = *s1++;
-      int c2 = *s2++;
-      if (isupper (c1))
-       c1 = tolower (c1);
-      if (isupper (c2))
-       c2 = tolower (c2);
-      if (c1 != c2)
-       return (c1 > c2 ? 1 : -1);
-      if (c1 == 0)
-       return 0;
-    }
+  return s ? xstrdup (s) : 0;
 }
-#endif /* HAVE_STRCASECMP */
 
 static void
 safe_free_str (char *s)
@@ -733,7 +702,7 @@ find_in_table (const char *type, const widget_creation_entry *table)
 {
   const widget_creation_entry* cur;
   for (cur = table; cur->type; cur++)
-    if (!lwlib_strcasecmp (type, cur->type))
+    if (!c_strcasecmp (type, cur->type))
       return cur->function;
   return NULL;
 }