From afe56517950e244cb8943611c0223c6d7adb7d35 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 23 May 2002 18:46:04 +0000 Subject: [PATCH] 2002-05-23 Jeff Johnston * libc/include/string.h (bcmp, bcopy, bzero): Change prototypes to use void * pointers and comply with Single Unix spec. * libc/string/bcmp.c: Change to use void * instead of char *. * libc/string/bcopy.c: Ditto. * libc/string/bzero.c: Ditto. --- newlib/ChangeLog | 8 ++++++++ newlib/libc/include/string.h | 6 +++--- newlib/libc/string/bcmp.c | 12 ++++++------ newlib/libc/string/bcopy.c | 12 ++++++------ newlib/libc/string/bzero.c | 9 +++++---- 5 files changed, 28 insertions(+), 19 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 43c5eb4ee..093e24f47 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,11 @@ +2002-05-23 Jeff Johnston + + * libc/include/string.h (bcmp, bcopy, bzero): Change prototypes + to use void * pointers and comply with Single Unix spec. + * libc/string/bcmp.c: Change to use void * instead of char *. + * libc/string/bcopy.c: Ditto. + * libc/string/bzero.c: Ditto. + 2002-05-22 Jeff Johnston * libc/sys/linux/shm_open.c: New file. diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h index e29a07b30..0c0d617cb 100644 --- a/newlib/libc/include/string.h +++ b/newlib/libc/include/string.h @@ -51,9 +51,9 @@ size_t _EXFUN(strxfrm,(char *, const char *, size_t)); #ifndef __STRICT_ANSI__ char *_EXFUN(strtok_r,(char *, const char *, char **)); -int _EXFUN(bcmp,(const char *, const char *, size_t)); -void _EXFUN(bcopy,(const char *, char *, size_t)); -void _EXFUN(bzero,(char *, size_t)); +int _EXFUN(bcmp,(const void *, const void *, size_t)); +void _EXFUN(bcopy,(const void *, void *, size_t)); +void _EXFUN(bzero,(void *, size_t)); int _EXFUN(ffs,(int)); char *_EXFUN(index,(const char *, int)); _PTR _EXFUN(memccpy,(_PTR, const _PTR, int, size_t)); diff --git a/newlib/libc/string/bcmp.c b/newlib/libc/string/bcmp.c index b6a4d5298..23e7c26a2 100644 --- a/newlib/libc/string/bcmp.c +++ b/newlib/libc/string/bcmp.c @@ -7,17 +7,17 @@ INDEX ANSI_SYNOPSIS #include - int bcmp(const char *<[s1]>, const char *<[s2]>, size_t <[n]>); + int bcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); TRAD_SYNOPSIS #include int bcmp(<[s1]>, <[s2]>, <[n]>) - char *<[s1]>; - char *<[s2]>; + const void *<[s1]>; + const void *<[s2]>; size_t <[n]>; DESCRIPTION - This function compares not more than <[n]> characters of the + This function compares not more than <[n]> bytes of the object pointed to by <[s1]> with the object pointed to by <[s2]>. This function is identical to <>. @@ -41,8 +41,8 @@ QUICKREF int _DEFUN (bcmp, (m1, m2, n), - _CONST char *m1 _AND - _CONST char *m2 _AND + _CONST void *m1 _AND + _CONST void *m2 _AND size_t n) { diff --git a/newlib/libc/string/bcopy.c b/newlib/libc/string/bcopy.c index 733840b83..505e39dc7 100644 --- a/newlib/libc/string/bcopy.c +++ b/newlib/libc/string/bcopy.c @@ -4,12 +4,12 @@ FUNCTION ANSI_SYNOPSIS #include - void bcopy(const char *<[in]>, char *<[out]>, size_t <[n]>); + void bcopy(const void *<[in]>, void *<[out]>, size_t <[n]>); TRAD_SYNOPSIS void bcopy(<[in]>, <[out]>, <[n]> - char *<[in]>; - char *<[out]>; + const void *<[in]>; + void *<[out]>; size_t <[n]>; DESCRIPTION @@ -30,9 +30,9 @@ QUICKREF void _DEFUN (bcopy, (b1, b2, length), - _CONST char *b1 _AND - char *b2 _AND + _CONST void *b1 _AND + void *b2 _AND size_t length) { - memmove ((_PTR) b2, (_PTR) b1, length); + memmove (b2, b1, length); } diff --git a/newlib/libc/string/bzero.c b/newlib/libc/string/bzero.c index e9e78c938..661285f7b 100644 --- a/newlib/libc/string/bzero.c +++ b/newlib/libc/string/bzero.c @@ -7,12 +7,12 @@ INDEX ANSI_SYNOPSIS #include - void bzero(char *<[b]>, size_t <[length]>); + void bzero(void *<[b]>, size_t <[length]>); TRAD_SYNOPSIS #include void bzero(<[b]>, <[length]>) - char *<[b]>; + void *<[b]>; size_t <[length]>; DESCRIPTION @@ -34,9 +34,10 @@ Neither ANSI C nor the System V Interface Definition (Issue 2) require _VOID _DEFUN (bzero, (b, length), - char *b _AND + void *b _AND size_t length) { + char *ptr = (char *)b; while (length--) - *b++ = 0; + *ptr++ = 0; }