[git commit master] drop __BCC__ cruft from string code

Mike Frysinger vapier at gentoo.org
Sat Oct 10 16:44:02 UTC 2009


commit: http://git.uclibc.org/uClibc/commit/?id=96a4928454fb7a8361a0b33940006ff491506f4d
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 libc/string/bcopy.c   |   19 -------------------
 libc/string/bzero.c   |   13 ++-----------
 libc/string/memchr.c  |   11 ++---------
 libc/string/memcpy.c  |    6 ------
 libc/string/memmove.c |   19 -------------------
 libc/string/mempcpy.c |    6 ------
 libc/string/memrchr.c |   15 +++------------
 libc/string/memset.c  |   11 ++---------
 libc/string/stpcpy.c  |    6 ------
 libc/string/stpncpy.c |    8 --------
 libc/string/strcpy.c  |    6 ------
 libc/string/strncat.c |    4 ----
 libc/string/strncpy.c |    7 -------
 libc/string/strnlen.c |   11 ++---------
 14 files changed, 11 insertions(+), 131 deletions(-)

diff --git a/libc/string/bcopy.c b/libc/string/bcopy.c
index 4b718f9..6234fd8 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 364456f..a541f36 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 438f4fa..99e13a2 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 cbb6e63..42436e0 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 8dcc6e4..9fb0efe 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 d79bd19..d1d752b 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 3a7e22f..60211f8 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 9daf59f..2a7c19d 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 58ace8f..2fd2c06 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 0524ee9..088145d 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 568efbf..bb5a168 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 cbbb0c5..0fa9b4a 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 ccf031b..4a44e1f 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 98267e5..08de088 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
-- 
1.6.3.3



More information about the uClibc-cvs mailing list