- Removed files for functions which are used from the string library.

svn path=/trunk/; revision=4781
This commit is contained in:
Hartmut Birr 2003-05-27 20:17:04 +00:00
parent 8761554070
commit 6796cee74b
23 changed files with 0 additions and 410 deletions

View file

@ -1,17 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
void *
memchr(const void *s, int c, size_t n)
{
if (n)
{
const char *p = s;
do {
if (*p++ == c)
return (void *)(p-1);
} while (--n != 0);
}
return 0;
}

View file

@ -1,16 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
#pragma function(memcmp)
int memcmp(const void *s1, const void *s2, size_t n)
{
if (n != 0) {
const unsigned char *p1 = s1, *p2 = s2;
do {
if (*p1++ != *p2++)
return (*--p1 - *--p2);
} while (--n != 0);
}
return 0;
}

View file

@ -1,17 +0,0 @@
#include <msvcrt/string.h>
#pragma function(memcpy)
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
void* memcpy(void* to, const void* from, size_t count)
{
register char* f = (char*)from;
register char* t = (char*)to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
return to;
}

View file

@ -1,36 +0,0 @@
#include <msvcrt/string.h>
void * memmove(void *dest,const void *src,size_t count)
{
char *char_dest = (char *)dest;
char *char_src = (char *)src;
if ((char_dest <= char_src) || (char_dest >= (char_src+count)))
{
/* non-overlapping buffers */
while(count > 0)
{
*char_dest = *char_src;
char_dest++;
char_src++;
count--;
}
}
else
{
/* overlaping buffers */
char_dest = (char *)dest + count - 1;
char_src = (char *)src + count - 1;
while(count > 0)
{
*char_dest = *char_src;
char_dest--;
char_src--;
count--;
}
}
return dest;
}

View file

@ -1,15 +0,0 @@
#include <msvcrt/string.h>
#pragma function(memset)
void* memset(void* src, int val, size_t count)
{
char* char_src = (char*)src;
while (count>0) {
*char_src = val;
char_src++;
count--;
}
return src;
}

View file

@ -1,13 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
#pragma function(strcat)
char* strcat(char* s, const char* append)
{
char* save = s;
for (; *s; ++s);
while ((*s++ = *append++));
return save;
}

View file

@ -1,19 +0,0 @@
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
char *strchr(const char *s, int c)
{
char cc = c;
while (*s)
{
if (*s == cc)
return (char *)s;
s++;
}
if (cc == 0)
return (char *)s;
return 0;
}

View file

@ -1,16 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
#pragma function(strcmp)
int strcmp(const char* s1, const char* s2)
{
while (*s1 == *s2)
{
if (*s1 == 0)
return 0;
s1++;
s2++;
}
return *(unsigned const char*)s1 - *(unsigned const char*)(s2);
}

View file

@ -1,12 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
#pragma function(strcpy)
char* strcpy(char *to, const char *from)
{
char *save = to;
for (; (*to = *from); ++from, ++to);
return save;
}

View file

@ -1,15 +0,0 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
#pragma function(strlen)
size_t strlen(const char* str)
{
const char* s;
if (str == 0)
return 0;
for (s = str; *s; ++s);
return s-str;
}

View file

@ -1,22 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
char *
strncat(char *dst, const char *src, size_t n)
{
if (n != 0)
{
char *d = dst;
const char *s = src;
while (*d != 0)
d++;
do {
if ((*d = *s++) == 0)
break;
d++;
} while (--n != 0);
*d = 0;
}
return dst;
}

View file

@ -1,18 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
int
strncmp(const char *s1, const char *s2, size_t n)
{
if (n == 0)
return 0;
do {
if (*s1 != *s2++)
return *(unsigned const char *)s1 - *(unsigned const char *)--s2;
if (*s1++ == 0)
break;
} while (--n != 0);
return 0;
}

View file

@ -1,21 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
char *
strncpy(char *dst, const char *src, size_t n)
{
if (n != 0) {
char *d = dst;
const char *s = src;
do {
if ((*d++ = *s++) == 0)
{
while (--n != 0)
*d++ = 0;
break;
}
} while (--n != 0);
}
return dst;
}

View file

@ -1,18 +0,0 @@
#include <msvcrt/string.h>
wchar_t * wcscat(wchar_t * dest,const wchar_t * src)
{
wchar_t *d = dest;
for (; *dest !=0; dest++);
while (*src != 0)
{
*dest = *src;
dest++;
src++;
}
*dest = 0;
return d;
}

View file

@ -1,16 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
wchar_t* wcschr(const wchar_t* str, wchar_t ch)
{
while ((*str)!=0)
{
if ((*str)==ch)
{
return((wchar_t *)str);
}
str++;
}
return(NULL);
}

View file

@ -1,15 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
int wcscmp(const wchar_t* cs,const wchar_t * ct)
{
while (*cs == *ct)
{
if (*cs == 0)
return 0;
cs++;
ct++;
}
return *cs - *ct;
}

View file

@ -1,11 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
wchar_t * wcscpy(wchar_t * str1,const wchar_t * str2)
{
wchar_t *save = str1;
for (; (*str1 = *str2); ++str2, ++str1);
return save;
}

View file

@ -1,14 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/string.h>
size_t wcslen(const wchar_t * s)
{
const wchar_t *save;
if (s == 0)
return 0;
for (save = s; *save; ++save);
return save-s;
}

View file

@ -1,21 +0,0 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <msvcrt/wchar.h>
wchar_t *wcsncat(wchar_t *dst, const wchar_t *src, size_t n)
{
if (n != 0)
{
wchar_t *d = dst;
const wchar_t *s = src;
while (*d != 0)
d++;
do {
if ((*d = *s++) == 0)
break;
d++;
} while (--n != 0);
*d = 0;
}
return dst;
}

View file

@ -1,33 +0,0 @@
#include <msvcrt/wchar.h>
#if 0
int wcsncmp(const wchar_t* cs, const wchar_t* ct, size_t count)
{
while ((*cs) == (*ct) && count > 0) {
if (*cs == 0)
return 0;
cs++;
ct++;
count--;
}
return (*cs) - (*ct);
}
#else
int wcsncmp(const wchar_t* cs, const wchar_t* ct, size_t count)
{
if (count == 0)
return 0;
do {
if (*cs != *ct++)
//return *(unsigned const char *)cs - *(unsigned const char *)--ct;
return (*cs) - (*(--ct));
if (*cs++ == 0)
break;
} while (--count != 0);
return 0;
}
#endif

View file

@ -1,20 +0,0 @@
#include <msvcrt/wchar.h>
wchar_t * wcsncpy(wchar_t * dest,const wchar_t *src,size_t count)
{
int i;
for (i=0;i<count;i++)
{
dest[i] = src[i];
if (src[i] == 0)
{
return(dest);
}
}
return(dest);
}

View file

@ -1,10 +0,0 @@
#include <msvcrt/wchar.h>
size_t _wcsnlen(const wchar_t * s, size_t count)
{
unsigned int len=0;
while(s[len]!=0 && len < count)
len++;
return len;
}

View file

@ -1,15 +0,0 @@
#include <msvcrt/string.h>
wchar_t* wcsrchr(const wchar_t* str, wchar_t ch)
{
wchar_t *sp=(wchar_t *)0;
while (*str != 0)
{
if (*str == ch)
sp = (wchar_t *)str;
str++;
}
if (ch == 0)
sp = (wchar_t *)str;
return sp;
}