GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libc/string/wcsdup.c Lines: 0 5 0.0 %
Date: 2017-11-13 Branches: 0 2 0.0 %

Line Branch Exec Source
1
/*	$OpenBSD: wcsdup.c,v 1.3 2015/09/12 16:23:14 guenther Exp $	*/
2
/*	$NetBSD: wcsdup.c,v 1.3 2008/05/26 13:17:48 haad Exp $	*/
3
4
/*
5
 * Copyright (C) 2006 Aleksey Cheusov
6
 *
7
 * This material is provided "as is", with absolutely no warranty expressed
8
 * or implied. Any use is at your own risk.
9
 *
10
 * Permission to use or copy this software for any purpose is hereby granted
11
 * without fee. Permission to modify the code and to distribute modified
12
 * code is also granted without any restrictions.
13
 */
14
15
#include <stdlib.h>
16
#include <wchar.h>
17
18
wchar_t *
19
wcsdup(const wchar_t *str)
20
{
21
	wchar_t *copy;
22
	size_t len;
23
24
	len = wcslen(str) + 1;
25
	copy = reallocarray(NULL, len, sizeof(wchar_t));
26
27
	if (!copy)
28
		return (NULL);
29
30
	return (wmemcpy(copy, str, len));
31
}
32
DEF_WEAK(wcsdup);