summaryrefslogtreecommitdiffstats
path: root/src/libnetdata/os/strndup.c
blob: 17210f1245a491cd91b3a92b191cb57bdcbd41fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef HAVE_STRNDUP
#include "../libnetdata.h"

static inline char *os_strndup( const char *s1, size_t n)
{
    char *copy= (char*)malloc( n+1 );
    memcpy( copy, s1, n );
    copy[n] = 0;
    return copy;
};
#endif