aboutsummaryrefslogtreecommitdiff
path: root/lib/libutils/ext/nex_strdup.c
blob: 07103271645fa6ecb0de28dc2d84dd7a218f1804 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// SPDX-License-Identifier: BSD-2-Clause
/*
 * Copyright (c) 2018 EPAM Systems
 */
#include <stdlib.h>
#include <string.h>
#include <string_ext.h>

char *nex_strdup(const char *s)
{
	size_t l = strlen(s) + 1;
	char *p = nex_malloc(l);

	if (p)
		memcpy(p, s, l);
	return p;
}