This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [patch] string.h/strings.h
- From: Ralf Corsepius <ralf dot corsepius at rtems dot org>
- To: Eric Blake <eblake at redhat dot com>
- Cc: Ralf Corsepius <ralf dot corsepius at rtems dot org>, "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Fri, 19 Aug 2011 16:10:50 +0200
- Subject: Re: [patch] string.h/strings.h
- References: <4E4E6ABB.9070501@rtems.org> <4E4E6C56.7070802@redhat.com>
On 08/19/2011 03:59 PM, Eric Blake wrote:
On 08/19/2011 07:52 AM, Ralf Corsepius wrote:
Hi,
I would like to apply the patch below.
It adds #include <strings.h> to assure these files receive the
prototypes of "string/strings family" functions, POSIX has moved, but
newlib still hasn't moved.
Ralf
newlib-strings.diff
2011-08-19 Ralf CorsÃÂpius<ralf.corsepius@rtems.org>
* libc/string/bcmp.c: Include<strings.h> for "memcmp".
Wrong wording - this file needs two headers: <strings.h> for (obsolete)
bcmp (missing, which meant we were implementing the function without
pulling in its declaration), but <string.h> for memcmp (already
present).
I knew, I would mix them up somewhere ;)
Next iteration of the patch attached below.
Ralf
2011-08-19 Ralf Corsépius <ralf.corsepius@rtems.org>
* libc/string/bcmp.c: Include <strings.h> for "bcmp".
* libc/string/bcopy.c: Include <strings.h> for "bcopy".
* libc/string/strcasestr.c: Include <strings.h> for "strncasecmp".
* libc/time/strptime.c: Include <strings.h> for "strncasecmp".
Index: libc/string/bcmp.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/string/bcmp.c,v
retrieving revision 1.3
diff -u -r1.3 bcmp.c
--- libc/string/bcmp.c 28 Oct 2005 21:21:07 -0000 1.3
+++ libc/string/bcmp.c 19 Aug 2011 14:08:59 -0000
@@ -36,6 +36,7 @@
*/
#include <string.h>
+#include <strings.h>
int
_DEFUN (bcmp, (m1, m2, n),
Index: libc/string/bcopy.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/string/bcopy.c,v
retrieving revision 1.2
diff -u -r1.2 bcopy.c
--- libc/string/bcopy.c 23 May 2002 18:46:04 -0000 1.2
+++ libc/string/bcopy.c 19 Aug 2011 14:08:59 -0000
@@ -27,6 +27,7 @@
*/
#include <string.h>
+#include <strings.h>
void
_DEFUN (bcopy, (b1, b2, length),
Index: libc/string/strcasestr.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/string/strcasestr.c,v
retrieving revision 1.3
diff -u -r1.3 strcasestr.c
--- libc/string/strcasestr.c 12 Jan 2008 04:25:55 -0000 1.3
+++ libc/string/strcasestr.c 19 Aug 2011 14:08:59 -0000
@@ -76,6 +76,7 @@
#include <ctype.h>
#include <string.h>
+#include <strings.h>
#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
# define RETURN_TYPE char *
Index: libc/time/strptime.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/time/strptime.c,v
retrieving revision 1.7
diff -u -r1.7 strptime.c
--- libc/time/strptime.c 12 May 2011 13:41:22 -0000 1.7
+++ libc/time/strptime.c 19 Aug 2011 14:09:00 -0000
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <time.h>
#include <string.h>
+#include <strings.h>
#include <ctype.h>
#include <stdlib.h>
#include "../locale/timelocal.h"