This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] libiberty/strdup.c: Constify the argument.


Hi,

Attached is a patch to constify the argument of strdup.

This was caught while I was building h8300-hms with Zack's c-decl.c
rewrite patch.  The patched GCC said

  error: argument "s" doesn't match prototype

The original GCC gives no error with or without const.

Bootstrapped on i686-pc-linux-gnu and built h8300-hms without Zack's
patch.  (Actually strdup.c is not compiled on i686-pc-linux-gnu.)  OK
to apply?

Kazu Hirata

2004-01-15  Kazu Hirata  <kazu@cs.umass.edu>

	* strdup.c (strdup): Consitify the argument.

Index: strdup.c
===================================================================
RCS file: /cvs/gcc/gcc/libiberty/strdup.c,v
retrieving revision 1.5
diff -u -r1.5 strdup.c
--- strdup.c	15 Apr 2003 02:11:43 -0000	1.5
+++ strdup.c	15 Jan 2004 05:58:15 -0000
@@ -22,7 +22,7 @@
 
 char *
 strdup(s)
-     char *s;
+     const char *s;
 {
   size_t len = strlen (s) + 1;
   char *result = (char*) malloc (len);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]