1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-18 19:41:01 -05:00

New utility function: dupwcs.

Just like dupstr, but for wchar_t strings.
This commit is contained in:
Simon Tatham
2023-05-28 11:49:12 +01:00
parent 5f43d11f83
commit 36db93748e
3 changed files with 21 additions and 0 deletions

19
utils/dupwcs.c Normal file
View File

@ -0,0 +1,19 @@
/*
* 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;
}