Browse Source

drop __BCC__ cruft from string code

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Mike Frysinger 14 years ago
parent
commit
96a4928454

+ 0 - 19
libc/string/bcopy.c

@@ -14,24 +14,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

+ 2 - 11
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

+ 2 - 9
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)

+ 0 - 6
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;
 }

+ 0 - 19
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

+ 0 - 6
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;
 }

+ 3 - 12
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

+ 2 - 9
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)

+ 0 - 6
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;
 }

+ 0 - 8
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

+ 0 - 6
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;
 }

+ 0 - 4
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;

+ 0 - 7
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;
 }

+ 2 - 9
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