[RFA/libiberty] use TOLOWER instead of tolower in filename_cmp.c

Joel Brobecker brobecker@adacore.com
Thu May 3 15:36:00 GMT 2007


> For locale-independent case conversion, use TOLOWER or TOUPPER in
> include/safe-ctype.h.

Thanks for the suggestion, Ian. Now that I'm back, here is a patch
that implements it.

2007-05-03  Joel Brobecker  <brobecker@adacore.com>

	* filename_cmp.c: Replace include of ctype.h by include of
	safe-ctype.h.
	(filename_cmp): Use TOLOWER instead of tolower for conversions
	that are locale-independent.
	* Makefile.in (filename_cmp.o): Add dependency on safe-ctype.h.

Tested on x86-linux and x86-windows. No regression.
OK to commit?

Thanks,
-- 
Joel
-------------- next part --------------
Index: filename_cmp.c
===================================================================
RCS file: /cvs/src/src/libiberty/filename_cmp.c,v
retrieving revision 1.3
diff -u -p -r1.3 filename_cmp.c
--- filename_cmp.c	6 Apr 2007 06:01:54 -0000	1.3
+++ filename_cmp.c	1 May 2007 22:09:55 -0000
@@ -24,8 +24,8 @@
 #include <string.h>
 #endif
 
-#include <ctype.h>
 #include "filenames.h"
+#include "safe-ctype.h"
 
 /*
 
@@ -55,8 +55,8 @@ filename_cmp (const char *s1, const char
 #else
   for (;;)
     {
-      int c1 = tolower (*s1);
-      int c2 = tolower (*s2);
+      int c1 = TOLOWER (*s1);
+      int c2 = TOLOWER (*s2);
 
       /* On DOS-based file systems, the '/' and the '\' are equivalent.  */
       if (c1 == '/')
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/libiberty/Makefile.in,v
retrieving revision 1.86
diff -u -p -r1.86 Makefile.in
--- Makefile.in	29 Mar 2007 21:03:48 -0000	1.86
+++ Makefile.in	1 May 2007 22:09:55 -0000
@@ -651,7 +651,8 @@ $(CONFIGURED_OFILES): stamp-picdir
 	else true; fi
 	$(COMPILE.c) $(srcdir)/fibheap.c $(OUTPUT_OPTION)
 
-./filename_cmp.o: $(srcdir)/filename_cmp.c $(INCDIR)/filenames.h
+./filename_cmp.o: $(srcdir)/filename_cmp.c $(INCDIR)/filenames.h \
+	$(INCDIR)/safe-ctype.h
 	if [ x"$(PICFLAG)" != x ]; then \
 	  $(COMPILE.c) $(PICFLAG) $(srcdir)/filename_cmp.c -o pic/$@; \
 	else true; fi


More information about the Gdb-patches mailing list