mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
22 lines
466 B
C
22 lines
466 B
C
|
/*
|
||
|
* Wrapper function around GetSystemDirectory that deals with
|
||
|
* allocating the output buffer, and also caches the result for future
|
||
|
* calls.
|
||
|
*/
|
||
|
|
||
|
#include "putty.h"
|
||
|
|
||
|
const char *get_system_dir(void)
|
||
|
{
|
||
|
static char *sysdir = NULL;
|
||
|
static size_t sysdirsize = 0;
|
||
|
|
||
|
if (!sysdir) {
|
||
|
size_t len;
|
||
|
while ((len = GetSystemDirectory(sysdir, sysdirsize)) >= sysdirsize)
|
||
|
sgrowarray(sysdir, sysdirsize, len);
|
||
|
}
|
||
|
|
||
|
return sysdir;
|
||
|
}
|