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]

libiberty strsignal


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The upcoming POSIX 200x will be standardizing strsignal, with a 'char *'
return type (consistent with glibc) and a note that the user must not
modify the returned string.  OK to apply?  Is there any special procedure
for committing libiberty patches?

2008-06-19 Eric Blake <ebb9@byu.net>

	Adjust strsignal to POSIX 200x prototype.
	* strsignal.c (strsignal): Remove const.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhZxs8ACgkQ84KuGfSFAYDd9ACeOY1Pa3LGtIz8XqcyVYVFiZGt
5/MAnj8FwW5PG0UGtZ+rl+S7CCDGNHoj
=W/7A
-----END PGP SIGNATURE-----
Index: strsignal.c
===================================================================
RCS file: /cvs/src/src/libiberty/strsignal.c,v
retrieving revision 1.10
diff -u -p -r1.10 strsignal.c
--- strsignal.c	30 Jan 2007 23:13:04 -0000	1.10
+++ strsignal.c	19 Jun 2008 02:36:31 -0000
@@ -404,10 +404,10 @@ call to @code{strsignal}.
 
 #ifndef HAVE_STRSIGNAL
 
-const char *
+char *
 strsignal (int signo)
 {
-  const char *msg;
+  char *msg;
   static char buf[32];
 
 #ifndef HAVE_SYS_SIGLIST
@@ -428,14 +428,16 @@ strsignal (int signo)
     {
       /* In range, but no sys_siglist or no entry at this index. */
       sprintf (buf, "Signal %d", signo);
-      msg = (const char *) buf;
+      msg = buf;
     }
   else
     {
-      /* In range, and a valid message.  Just return the message. */
-      msg = (const char *) sys_siglist[signo];
+      /* In range, and a valid message.  Just return the message.  We
+	 can safely cast away const, since POSIX says the user must
+	 not modify the result.*/
+      msg = (char *) sys_siglist[signo];
     }
-  
+
   return (msg);
 }
 

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