stm: Remove unused, useless and not-to-be-used strndup.
Addresses issue #275.
This commit is contained in:
parent
f1081f400b
commit
181d190643
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue