stm: Remove unused, useless and not-to-be-used strndup.

Addresses issue #275.
genexit-inst
Damien George 2014-02-10 22:55:15 +00:00
parent f1081f400b
commit 181d190643
3 changed files with 0 additions and 13 deletions

View File

@ -13,7 +13,6 @@ void *memset(void *s, int c, size_t n);
size_t strlen(const char *str);
int strcmp(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, size_t n);
char *strndup(const char *s, size_t n);
char *strcpy(char *dest, const char *src);
char *strcat(char *dest, const char *src);
char *strchr(const char *s, int c);

View File

@ -78,17 +78,6 @@ int strncmp(const char *s1, const char *s2, size_t n) {
else return 0;
}
char *strndup(const char *s, size_t n) {
size_t len = strlen(s);
if (n > len) {
n = len;
}
char *s2 = malloc(n + 1);
memcpy(s2, s, n);
s2[n] = '\0';
return s2;
}
char *strcpy(char *dest, const char *src) {
char *d = dest;
while (*src) {

View File

@ -13,7 +13,6 @@ void *memset(void *s, int c, size_t n);
int strlen(const char *str);
int strcmp(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, size_t n);
char *strndup(const char *s, size_t n);
char *strcpy(char *dest, const char *src);
char *strcat(char *dest, const char *src);