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:
anders_k 2014-05-20 20:13:54 +00:00
parent f19f561f40
commit 9c1d673c25
2 changed files with 7 additions and 10 deletions

View file

@ -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)

View file

@ -164,6 +164,7 @@ PLUGINFUNCTION(Debug)
CloseHandle(logfile);
logfile = NULL;
}
if (o1) GlobalFree(o1);
} PLUGINFUNCTIONEND
#else