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:
@ -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
|
||||
|
Reference in New Issue
Block a user