summaryrefslogtreecommitdiff
path: root/lib/strndup.c
blob: f2caa70f289d95bc79c8cd8dd06f76a3cf309e2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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;
}