master
c 13 lines 264 Bytes
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #ifndef HAVE_STRNDUP
4 #include "../libnetdata.h"
5
6 static inline char *os_strndup( const char *s1, size_t n)
7 {
8 char *copy= (char*)malloc( n+1 );
9 memcpy( copy, s1, n );
10 copy[n] = 0;
11 return copy;
12 };
13 #endif