#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;
}
}
#endif
-#endif
}
#endif
#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
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)
register Wchar *r1 = s1;
register const Wchar *r2 = s2;
-#ifdef __BCC__
- while (n--) {
- *r1++ = *r2++;
- }
-#else
while (n) {
*r1++ = *r2++;
--n;
}
-#endif
return s1;
}
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;
}
return s1;
-#endif
}
#ifndef WANT_WIDE
register Wchar *r1 = s1;
register const Wchar *r2 = s2;
-#ifdef __BCC__
- while (n--) {
- *r1++ = *r2++;
- }
-#else
while (n) {
*r1++ = *r2++;
--n;
}
-#endif
return r1;
}
#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
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)
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;
}
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
{
register Wchar *s = s1;
-#ifdef __BCC__
- do {
- *s = *s2++;
- } while (*s++ != 0);
-#else
while ( (*s++ = *s2++) != 0 );
-#endif
return s1;
}
while (*s++);
--s;
-#ifdef __BCC__
- while (n-- && ((*s = *s2++) != 0)) ++s;
-#else
while (n && ((*s = *s2++) != 0)) {
--n;
++s;
}
-#endif
*s = 0;
return s1;
{
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;
}
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