Merging changes from AeroXuk/libpostal_windows.
This commit is contained in:
16
src/strndup.c
Normal file
16
src/strndup.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef HAVE_STRNDUP
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
char *strndup(const char *s, size_t n)
|
||||
{
|
||||
char* new = malloc(n+1);
|
||||
if (new) {
|
||||
strncpy(new, s, n);
|
||||
new[n] = '\0';
|
||||
}
|
||||
return new;
|
||||
}
|
||||
|
||||
#endif /* HAVE_STRNDUP */
|
||||
Reference in New Issue
Block a user