1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-22 13:20:05 +00:00

Get rid of most _alloca use and remove ALLOCA().

This commit is contained in:
Darryl Pogue
2011-10-23 23:01:19 -07:00
committed by Adam Johnson
parent 8a3f0cfd5b
commit 6cdcf6a95e
15 changed files with 109 additions and 103 deletions

View File

@ -212,10 +212,12 @@ static bool AdvanceStep (
++start;
const char * term = StrChr(start, ';');
if (term) {
char * buffer = ALLOCA(char, term + 1 - start);
char * buffer = (char*)malloc(term + 1 - start);
StrCopy(buffer, start, term + 1 - start);
Send(sock, "rcpt to:<", buffer, ">\r\n", nil);
transaction->subStep = term + 1 - transaction->recipient;
free(buffer);
}
else {
Send(sock, "rcpt to:<", start, ">\r\n", nil);
@ -445,12 +447,7 @@ static void __cdecl Send (
}
// Allocate string buffer
char * packed;
const unsigned kStackBufSize = 8 * 1024;
if (bytes > kStackBufSize)
packed = (char *) malloc(bytes);
else
packed = (char *) _alloca(bytes);
char* packed = (char *) malloc(bytes);
// Pack the string
{
@ -466,8 +463,7 @@ static void __cdecl Send (
AsyncSocketSend(sock, packed, bytes - 1);
// Free the string
if (bytes > kStackBufSize)
free(packed);
free(packed);
}
//===========================================================================