Switch to using safe-ctype.h

Nick Clifton nickc@redhat.com
Thu May 29 16:07:00 GMT 2003


Hi Guys,

  I am applying the patch below to switch PE based targets over to use
  "safe-ctype.h" instead of <ctype.h>.

Cheers
        Nick

bfd/ChangeLog
2003-05-29  Nick Clifton  <nickc@redhat.com>

	* pef.c: Include "safe-ctype.h" instead of <ctype.h>.
	* Makefile.am: Add dependency on safe-ctype.h.
	* Makefile.in: Regenerate.

ld/ChangeLog
2003-05-29  Nick Clifton  <nickc@redhat.com>

	* emultempl/pe.em: Include "safe-ctype.h" instead of <ctype.h>.

Index: bfd/pef.c
===================================================================
RCS file: /cvs/src/src/bfd/pef.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 pef.c
*** bfd/pef.c	30 Nov 2002 08:39:40 -0000	1.4
--- bfd/pef.c	29 May 2003 15:00:18 -0000
***************
*** 18,24 ****
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  
! #include <ctype.h>
  
  #include "pef.h"
  #include "pef-traceback.h"
--- 18,24 ----
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  
! #include "safe-ctype.h"
  
  #include "pef.h"
  #include "pef-traceback.h"
*************** bfd_pef_parse_traceback_table (abfd, sec
*** 271,284 ****
        memcpy (namebuf, buf + pos + offset, name.name_len);
        namebuf[name.name_len] = '\0';
  
!       /* strip leading period inserted by compiler */
        if (namebuf[0] == '.')
  	memmove (namebuf, namebuf + 1, name.name_len + 1);
  
        sym->name = namebuf;
  
        for (s = sym->name; (*s != '\0'); s++)
! 	if (! isprint (*s))
  	  return -1;
  
        offset += name.name_len;
--- 252,265 ----
        memcpy (namebuf, buf + pos + offset, name.name_len);
        namebuf[name.name_len] = '\0';
  
!       /* Strip leading period inserted by compiler.  */
        if (namebuf[0] == '.')
  	memmove (namebuf, namebuf + 1, name.name_len + 1);
  
        sym->name = namebuf;
  
        for (s = sym->name; (*s != '\0'); s++)
! 	if (! ISPRINT (*s))
  	  return -1;
  
        offset += name.name_len;
*************** static int bfd_pef_parse_function_stubs 
*** 913,919 ****
  	  {
  	    if (*s == '\0')
  	      break;
! 	    if (! isprint (*s))
  	      goto error;
  	    namelen++;
  	  }
--- 893,899 ----
  	  {
  	    if (*s == '\0')
  	      break;
! 	    if (! ISPRINT (*s))
  	      goto error;
  	    namelen++;
  	  }

Index: bfd/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/Makefile.am,v
retrieving revision 1.120
diff -c -3 -p -r1.120 Makefile.am
*** bfd/Makefile.am	21 Apr 2003 13:24:18 -0000	1.120
--- bfd/Makefile.am	29 May 2003 15:00:19 -0000
*************** pdp11.lo: pdp11.c $(INCDIR)/filenames.h 
*** 1414,1420 ****
    aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
    $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h
  pef.lo: pef.c pef.h pef-traceback.h $(INCDIR)/filenames.h \
!   $(INCDIR)/libiberty.h
  pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
    $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
    $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
--- 1414,1420 ----
    aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
    $(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h $(INCDIR)/safe-ctype.h
  pef.lo: pef.c pef.h pef-traceback.h $(INCDIR)/filenames.h \
!   $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
  pe-arm.lo: pe-arm.c $(INCDIR)/filenames.h coff-arm.c \
    $(INCDIR)/coff/arm.h $(INCDIR)/coff/external.h $(INCDIR)/coff/internal.h \
    $(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \

Index: ld/emultempl/pe.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/pe.em,v
retrieving revision 1.77
diff -c -3 -p -r1.77 pe.em
*** ld/emultempl/pe.em	2 Apr 2003 17:39:24 -0000	1.77
--- ld/emultempl/pe.em	29 May 2003 15:00:23 -0000
*************** cat >>e${EMULATION_NAME}.c <<EOF
*** 68,75 ****
  
  #include "deffile.h"
  #include "pe-dll.h"
! 
! #include <ctype.h>
  
  /* Permit the emulation parameters to override the default section
     alignment by setting OVERRIDE_SECTION_ALIGNMENT.  FIXME: This makes
--- 68,74 ----
  
  #include "deffile.h"
  #include "pe-dll.h"
! #include "safe-ctype.h"
  
  /* Permit the emulation parameters to override the default section
     alignment by setting OVERRIDE_SECTION_ALIGNMENT.  FIXME: This makes
*************** gld_${EMULATION_NAME}_place_orphan (file
*** 1648,1654 ****
  	  /* If the name of the section is representable in C, then create
  	     symbols to mark the start and the end of the section.  */
  	  for (ps = outsecname; *ps != '\0'; ps++)
! 	    if (! isalnum ((unsigned char) *ps) && *ps != '_')
  	      break;
  	  if (*ps == '\0')
  	    {
--- 1647,1653 ----
  	  /* If the name of the section is representable in C, then create
  	     symbols to mark the start and the end of the section.  */
  	  for (ps = outsecname; *ps != '\0'; ps++)
! 	    if (! ISALNUM ((unsigned char) *ps) && *ps != '_')
  	      break;
  	  if (*ps == '\0')
  	    {
        



More information about the Binutils mailing list