system_popstring can reuse the HGLOBAL, no need to allocate string storage
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6489 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
f19f561f40
commit
9c1d673c25
2 changed files with 7 additions and 10 deletions
|
@ -21,18 +21,14 @@ TCHAR *AllocStr(TCHAR *str)
|
|||
|
||||
TCHAR* system_popstring()
|
||||
{
|
||||
TCHAR *str;
|
||||
stack_t *th;
|
||||
stack_t *pSt;
|
||||
TCHAR *src, *dst, *retval;
|
||||
|
||||
if (!g_stacktop || !*g_stacktop) return NULL;
|
||||
th=(*g_stacktop);
|
||||
if (!g_stacktop || !*g_stacktop) return NULL;
|
||||
pSt = *g_stacktop, *g_stacktop = pSt->next, src = pSt->text, dst = (TCHAR*)pSt;
|
||||
|
||||
str = AllocString();
|
||||
lstrcpy(str,th->text);
|
||||
|
||||
*g_stacktop = th->next;
|
||||
GlobalFree((HGLOBAL)th);
|
||||
return str;
|
||||
// We don't have to call AllocString+lstrcpy+GlobalFree if we convert the stack item to a string
|
||||
for (retval = dst;;) if (!(*dst++ = *src++)) return retval;
|
||||
}
|
||||
|
||||
TCHAR *system_pushstring(TCHAR *str)
|
||||
|
|
|
@ -164,6 +164,7 @@ PLUGINFUNCTION(Debug)
|
|||
CloseHandle(logfile);
|
||||
logfile = NULL;
|
||||
}
|
||||
if (o1) GlobalFree(o1);
|
||||
} PLUGINFUNCTIONEND
|
||||
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue