diff options
Diffstat (limited to 'lib/strndup.c')
-rw-r--r-- | lib/strndup.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/strndup.c b/lib/strndup.c new file mode 100644 index 000000000..f2caa70f2 --- /dev/null +++ b/lib/strndup.c @@ -0,0 +1,13 @@ +#include "config.h" + +#include <malloc.h> +#include <string.h> + +char *_xine_private_strndup(const char *s, size_t n) { + char *ret; + + ret = malloc (n + 1); + strncpy(ret, s, n); + ret[n] = '\0'; + return ret; +} |