File: nex_strdup.c

package info (click to toggle)
optee-os 4.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,560 kB
  • sloc: ansic: 441,914; asm: 12,903; python: 3,719; makefile: 1,676; sh: 238
file content (17 lines) | stat: -rw-r--r-- 276 bytes parent folder | download | duplicates (2)
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;
}