1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-02 20:12:48 -05:00

Move a recently introduced utility function out of the file in which I

declared it static, and into winutils.c where it can be more generally
accessible.

[originally from svn r9318]
This commit is contained in:
Simon Tatham
2011-10-02 13:53:58 +00:00
parent da66c0656a
commit 535d77abf0
3 changed files with 22 additions and 16 deletions

View File

@ -150,6 +150,25 @@ void pgp_fingerprints(void)
HELPCTXID(pgp_fingerprints));
}
/*
* Handy wrapper around GetDlgItemText which doesn't make you invent
* an arbitrary length limit on the output string. Returned string is
* dynamically allocated; caller must free.
*/
char *GetDlgItemText_alloc(HWND hwnd, int id)
{
char *ret = NULL;
int size = 0;
do {
size = size * 4 / 3 + 512;
ret = sresize(ret, size, char);
GetDlgItemText(hwnd, id, ret, size);
} while (!memchr(ret, '\0', size-1));
return ret;
}
/*
* Split a complete command line into argc/argv, attempting to do
* it exactly the same way Windows itself would do it (so that