mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-13 23:01:31 +00:00
move strndup back to string.c - used by strdup
This commit is contained in:
parent
7e8e4f8abd
commit
6b6dbe5600
@ -271,18 +271,3 @@ void * memscan(const void * addr, int c, size_t size)
|
||||
return (void *) p;
|
||||
}
|
||||
#endif
|
||||
|
||||
char * strndup(const char *s, size_t n)
|
||||
{
|
||||
size_t len = strlen(s);
|
||||
char *new;
|
||||
|
||||
if (len>n)
|
||||
len = n;
|
||||
new = malloc(len+1);
|
||||
if (new) {
|
||||
new[len] = '\0';
|
||||
memcpy(new,s,len);
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user