summaryrefslogtreecommitdiff
path: root/libc/string
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-10-10 12:44:02 -0400
committerMike Frysinger <vapier@gentoo.org>2009-10-10 12:44:02 -0400
commit96a4928454fb7a8361a0b33940006ff491506f4d (patch)
treef1a8bf7507cc686c2839dd569325cf157a3234f1 /libc/string
parent00d805f334c009164d7cecab931086a0545af8d1 (diff)
drop __BCC__ cruft from string code
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libc/string')
-rw-r--r--libc/string/bcopy.c19
-rw-r--r--libc/string/bzero.c13
-rw-r--r--libc/string/memchr.c11
-rw-r--r--libc/string/memcpy.c6
-rw-r--r--libc/string/memmove.c19
-rw-r--r--libc/string/mempcpy.c6
-rw-r--r--libc/string/memrchr.c15
-rw-r--r--libc/string/memset.c11
-rw-r--r--libc/string/stpcpy.c6
-rw-r--r--libc/string/stpncpy.c8
-rw-r--r--libc/string/strcpy.c6
-rw-r--r--libc/string/strncat.c4
-rw-r--r--libc/string/strncpy.c7
-rw-r--r--libc/string/strnlen.c11
14 files changed, 11 insertions, 131 deletions
diff --git a/libc/string/bcopy.c b/libc/string/bcopy.c
index 4b718f98d..6234fd807 100644
--- a/libc/string/bcopy.c
+++ b/libc/string/bcopy.c
@@ -15,24 +15,6 @@ void bcopy(const void *s2, void *s1, size_t n)
#if 1
memmove(s1, s2, n);
#else
-#ifdef __BCC__
- register char *s;
- register const char *p;
-
- s = s1;
- p = s2;
- if (p >= s) {
- while (n--) {
- *s++ = *p++;
- }
- } else {
- s += n;
- p += n;
- while (n--) {
- *--s = *--p;
- }
- }
-#else
register char *s;
register const char *p;
@@ -50,6 +32,5 @@ void bcopy(const void *s2, void *s1, size_t n)
}
}
#endif
-#endif
}
#endif
diff --git a/libc/string/bzero.c b/libc/string/bzero.c
index 364456fff..a541f369b 100644
--- a/libc/string/bzero.c
+++ b/libc/string/bzero.c
@@ -8,26 +8,17 @@
#include "_string.h"
#ifdef __UCLIBC_SUSV3_LEGACY__
-
-
void bzero(void *s, size_t n)
{
#if 1
(void)memset(s, 0, n);
#else
register unsigned char *p = s;
-#ifdef __BCC__
- /* bcc can optimize the counter if it thinks it is a pointer... */
- register const char *np = (const char *) n;
-#else
-#define np n
-#endif
- while (np) {
+ while (n) {
*p++ = 0;
- --np;
+ --n;
}
#endif
}
-#undef np
#endif
diff --git a/libc/string/memchr.c b/libc/string/memchr.c
index 438f4fa4a..99e13a2fc 100644
--- a/libc/string/memchr.c
+++ b/libc/string/memchr.c
@@ -17,23 +17,16 @@
Wvoid *Wmemchr(const Wvoid *s, Wint c, size_t n)
{
register const Wuchar *r = (const Wuchar *) s;
-#ifdef __BCC__
- /* bcc can optimize the counter if it thinks it is a pointer... */
- register const char *np = (const char *) n;
-#else
-# define np n
-#endif
- while (np) {
+ while (n) {
if (*r == ((Wuchar)c)) {
return (Wvoid *) r; /* silence the warning */
}
++r;
- --np;
+ --n;
}
return NULL;
}
-#undef np
libc_hidden_def(Wmemchr)
diff --git a/libc/string/memcpy.c b/libc/string/memcpy.c
index cbb6e633a..42436e0b6 100644
--- a/libc/string/memcpy.c
+++ b/libc/string/memcpy.c
@@ -19,16 +19,10 @@ Wvoid *Wmemcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
register Wchar *r1 = s1;
register const Wchar *r2 = s2;
-#ifdef __BCC__
- while (n--) {
- *r1++ = *r2++;
- }
-#else
while (n) {
*r1++ = *r2++;
--n;
}
-#endif
return s1;
}
diff --git a/libc/string/memmove.c b/libc/string/memmove.c
index 8dcc6e49b..9fb0efee4 100644
--- a/libc/string/memmove.c
+++ b/libc/string/memmove.c
@@ -15,24 +15,6 @@
Wvoid *Wmemmove(Wvoid *s1, const Wvoid *s2, size_t n)
{
-#ifdef __BCC__
- register Wchar *s = (Wchar *) s1;
- register const Wchar *p = (const Wchar *) s2;
-
- if (p >= s) {
- while (n--) {
- *s++ = *p++;
- }
- } else {
- s += n;
- p += n;
- while (n--) {
- *--s = *--p;
- }
- }
-
- return s1;
-#else
register Wchar *s = (Wchar *) s1;
register const Wchar *p = (const Wchar *) s2;
@@ -49,7 +31,6 @@ Wvoid *Wmemmove(Wvoid *s1, const Wvoid *s2, size_t n)
}
return s1;
-#endif
}
#ifndef WANT_WIDE
diff --git a/libc/string/mempcpy.c b/libc/string/mempcpy.c
index d79bd1937..d1d752b50 100644
--- a/libc/string/mempcpy.c
+++ b/libc/string/mempcpy.c
@@ -21,16 +21,10 @@ Wvoid *Wmempcpy(Wvoid * __restrict s1, const Wvoid * __restrict s2, size_t n)
register Wchar *r1 = s1;
register const Wchar *r2 = s2;
-#ifdef __BCC__
- while (n--) {
- *r1++ = *r2++;
- }
-#else
while (n) {
*r1++ = *r2++;
--n;
}
-#endif
return r1;
}
diff --git a/libc/string/memrchr.c b/libc/string/memrchr.c
index 3a7e22f9b..60211f804 100644
--- a/libc/string/memrchr.c
+++ b/libc/string/memrchr.c
@@ -8,30 +8,21 @@
#include "_string.h"
#ifdef __USE_GNU
-
-
void *memrchr(const void *s, int c, size_t n)
{
register const unsigned char *r;
-#ifdef __BCC__
- /* bcc can optimize the counter if it thinks it is a pointer... */
- register const char *np = (const char *) n;
-#else
-#define np n
-#endif
- r = ((unsigned char *)s) + ((size_t) np);
+ r = ((unsigned char *)s) + ((size_t) n);
- while (np) {
+ while (n) {
if (*--r == ((unsigned char)c)) {
return (void *) r; /* silence the warning */
}
- --np;
+ --n;
}
return NULL;
}
-#undef np
libc_hidden_def(memrchr)
#endif
diff --git a/libc/string/memset.c b/libc/string/memset.c
index 9daf59f69..2a7c19dee 100644
--- a/libc/string/memset.c
+++ b/libc/string/memset.c
@@ -17,21 +17,14 @@
Wvoid *Wmemset(Wvoid *s, Wint c, size_t n)
{
register Wuchar *p = (Wuchar *) s;
-#ifdef __BCC__
- /* bcc can optimize the counter if it thinks it is a pointer... */
- register const char *np = (const char *) n;
-#else
-# define np n
-#endif
- while (np) {
+ while (n) {
*p++ = (Wuchar) c;
- --np;
+ --n;
}
return s;
}
-#undef np
#ifndef WANT_WIDE
libc_hidden_def(memset)
diff --git a/libc/string/stpcpy.c b/libc/string/stpcpy.c
index 58ace8fc7..2fd2c0648 100644
--- a/libc/string/stpcpy.c
+++ b/libc/string/stpcpy.c
@@ -16,13 +16,7 @@
Wchar *Wstpcpy(register Wchar * __restrict s1, const Wchar * __restrict s2)
{
-#ifdef __BCC__
- do {
- *s1 = *s2++;
- } while (*s1++ != 0);
-#else
while ( (*s1++ = *s2++) != 0 );
-#endif
return s1 - 1;
}
diff --git a/libc/string/stpncpy.c b/libc/string/stpncpy.c
index 0524ee93e..088145dea 100644
--- a/libc/string/stpncpy.c
+++ b/libc/string/stpncpy.c
@@ -20,20 +20,12 @@ Wchar *Wstpncpy(register Wchar * __restrict s1,
Wchar *s = s1;
const Wchar *p = s2;
-#ifdef __BCC__
- while (n--) {
- if ((*s = *s2) != 0) s2++; /* Need to fill tail with 0s. */
- ++s;
- }
- return s1 + (s2 - p);
-#else
while (n) {
if ((*s = *s2) != 0) s2++; /* Need to fill tail with 0s. */
++s;
--n;
}
return s1 + (s2 - p);
-#endif
}
#ifndef WANT_WIDE
diff --git a/libc/string/strcpy.c b/libc/string/strcpy.c
index 568efbf60..bb5a16872 100644
--- a/libc/string/strcpy.c
+++ b/libc/string/strcpy.c
@@ -17,13 +17,7 @@ Wchar *Wstrcpy(Wchar * __restrict s1, const Wchar * __restrict s2)
{
register Wchar *s = s1;
-#ifdef __BCC__
- do {
- *s = *s2++;
- } while (*s++ != 0);
-#else
while ( (*s++ = *s2++) != 0 );
-#endif
return s1;
}
diff --git a/libc/string/strncat.c b/libc/string/strncat.c
index cbbb0c540..0fa9b4ae1 100644
--- a/libc/string/strncat.c
+++ b/libc/string/strncat.c
@@ -20,14 +20,10 @@ Wchar *Wstrncat(Wchar * __restrict s1, register const Wchar * __restrict s2,
while (*s++);
--s;
-#ifdef __BCC__
- while (n-- && ((*s = *s2++) != 0)) ++s;
-#else
while (n && ((*s = *s2++) != 0)) {
--n;
++s;
}
-#endif
*s = 0;
return s1;
diff --git a/libc/string/strncpy.c b/libc/string/strncpy.c
index ccf031b1b..4a44e1f02 100644
--- a/libc/string/strncpy.c
+++ b/libc/string/strncpy.c
@@ -18,18 +18,11 @@ Wchar *Wstrncpy(Wchar * __restrict s1, register const Wchar * __restrict s2,
{
register Wchar *s = s1;
-#ifdef __BCC__
- while (n--) {
- if ((*s = *s2) != 0) s2++; /* Need to fill tail with 0s. */
- ++s;
- }
-#else
while (n) {
if ((*s = *s2) != 0) s2++; /* Need to fill tail with 0s. */
++s;
--n;
}
-#endif
return s1;
}
diff --git a/libc/string/strnlen.c b/libc/string/strnlen.c
index 98267e51b..08de0887d 100644
--- a/libc/string/strnlen.c
+++ b/libc/string/strnlen.c
@@ -18,21 +18,14 @@
size_t Wstrnlen(const Wchar *s, size_t max)
{
register const Wchar *p = s;
-#ifdef __BCC__
- /* bcc can optimize the counter if it thinks it is a pointer... */
- register const char *maxp = (const char *) max;
-#else
-# define maxp max
-#endif
- while (maxp && *p) {
+ while (max && *p) {
++p;
- --maxp;
+ --max;
}
return p - s;
}
-#undef maxp
libc_hidden_def(Wstrnlen)
#endif