mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Fix by Royce3
svn path=/trunk/; revision=4112
This commit is contained in:
parent
a9b14e9d16
commit
0f7e47f8bd
2 changed files with 23 additions and 10 deletions
|
@ -4,6 +4,18 @@
|
||||||
void *
|
void *
|
||||||
_memccpy (void *to, const void *from,int c,size_t count)
|
_memccpy (void *to, const void *from,int c,size_t count)
|
||||||
{
|
{
|
||||||
memcpy(to,from,count);
|
char t;
|
||||||
return memchr(to,c,count);
|
size_t i;
|
||||||
|
char *dst=(char*)to;
|
||||||
|
const char *src=(const char*)from;
|
||||||
|
|
||||||
|
for ( i = 0; i < count; i++ )
|
||||||
|
{
|
||||||
|
dst[i] = t = src[i];
|
||||||
|
if ( t == '\0' )
|
||||||
|
break;
|
||||||
|
if ( t == c )
|
||||||
|
return &dst[i+1];
|
||||||
|
}
|
||||||
|
return NULL; /* didn't copy c */
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,17 +2,18 @@
|
||||||
|
|
||||||
char * _strrev(char *s)
|
char * _strrev(char *s)
|
||||||
{
|
{
|
||||||
char *e;
|
char a, *b, *e;
|
||||||
char a;
|
b=e=s;
|
||||||
e=s;
|
|
||||||
while (*e)
|
while (*e)
|
||||||
e++;
|
e++;
|
||||||
while (s<e) {
|
e--; /* start at last char, not NULL char */
|
||||||
a=*s;
|
while ( b < e )
|
||||||
*s=*e;
|
{
|
||||||
|
a=*b;
|
||||||
|
*b=*e;
|
||||||
*e=a;
|
*e=a;
|
||||||
s++;
|
b++;
|
||||||
e--;
|
e--;
|
||||||
}
|
}
|
||||||
return s;
|
return s; /* return ptr to beginning of string */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue