mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
36db93748e
Just like dupstr, but for wchar_t strings.
20 lines
307 B
C
20 lines
307 B
C
/*
|
|
* Allocate a duplicate of a NUL-terminated wchar_t string.
|
|
*/
|
|
|
|
#include <wchar.h>
|
|
|
|
#include "defs.h"
|
|
#include "misc.h"
|
|
|
|
wchar_t *dupwcs(const wchar_t *s)
|
|
{
|
|
wchar_t *p = NULL;
|
|
if (s) {
|
|
int len = wcslen(s);
|
|
p = snewn(len + 1, wchar_t);
|
|
wcscpy(p, s);
|
|
}
|
|
return p;
|
|
}
|