HeapAlloc() changed to HeapAllocMem() to avoid clash with win32 namespace.
git-svn-id: http://picoc.googlecode.com/svn/trunk@321 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
bb0d19a733
commit
eb6f323f06
|
@ -25,7 +25,7 @@ void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct Libr
|
|||
TypeParse(&Parser, &ReturnType, &Identifier);
|
||||
NewValue = ParseFunctionDefinition(&Parser, ReturnType, Identifier, TRUE);
|
||||
NewValue->Val->FuncDef.Intrinsic = (*FuncList)[Count].Func;
|
||||
HeapFree(Tokens);
|
||||
HeapFreeMem(Tokens);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
4
heap.c
4
heap.c
|
@ -119,7 +119,7 @@ int HeapPopStackFrame()
|
|||
}
|
||||
|
||||
/* allocate some dynamically allocated memory. memory is cleared. can return NULL if out of memory */
|
||||
void *HeapAlloc(int Size)
|
||||
void *HeapAllocMem(int Size)
|
||||
{
|
||||
#ifdef USE_MALLOC_HEAP
|
||||
return calloc(Size, 1);
|
||||
|
@ -203,7 +203,7 @@ void *HeapAlloc(int Size)
|
|||
}
|
||||
|
||||
/* free some dynamically allocated memory */
|
||||
void HeapFree(void *Mem)
|
||||
void HeapFreeMem(void *Mem)
|
||||
{
|
||||
#ifdef USE_MALLOC_HEAP
|
||||
return free(Mem);
|
||||
|
|
10
lex.c
10
lex.c
|
@ -461,7 +461,7 @@ void *LexTokenise(struct LexState *Lexer, int *TokenLen)
|
|||
|
||||
} while (Token != TokenEOF);
|
||||
|
||||
HeapMem = HeapAlloc(MemUsed);
|
||||
HeapMem = HeapAllocMem(MemUsed);
|
||||
if (HeapMem == NULL)
|
||||
LexFail(Lexer, "out of memory");
|
||||
|
||||
|
@ -702,8 +702,8 @@ void LexInteractiveClear(struct ParseState *Parser)
|
|||
{
|
||||
struct TokenLine *NextLine = InteractiveHead->Next;
|
||||
|
||||
HeapFree(InteractiveHead->Tokens);
|
||||
HeapFree(InteractiveHead);
|
||||
HeapFreeMem(InteractiveHead->Tokens);
|
||||
HeapFreeMem(InteractiveHead);
|
||||
InteractiveHead = NextLine;
|
||||
}
|
||||
|
||||
|
@ -720,8 +720,8 @@ void LexInteractiveCompleted(struct ParseState *Parser)
|
|||
/* this token line is no longer needed - free it */
|
||||
struct TokenLine *NextLine = InteractiveHead->Next;
|
||||
|
||||
HeapFree(InteractiveHead->Tokens);
|
||||
HeapFree(InteractiveHead);
|
||||
HeapFreeMem(InteractiveHead->Tokens);
|
||||
HeapFreeMem(InteractiveHead);
|
||||
InteractiveHead = NextLine;
|
||||
|
||||
if (InteractiveHead == NULL)
|
||||
|
|
4
parse.c
4
parse.c
|
@ -7,7 +7,7 @@ static void *CleanupTokens = NULL;
|
|||
void ParseCleanup()
|
||||
{
|
||||
if (CleanupTokens != NULL)
|
||||
HeapFree(CleanupTokens);
|
||||
HeapFreeMem(CleanupTokens);
|
||||
}
|
||||
|
||||
/* parse a statement, but only run it if Condition is TRUE */
|
||||
|
@ -554,7 +554,7 @@ void Parse(const char *FileName, const char *Source, int SourceLen, int RunIt)
|
|||
if (LexGetToken(&Parser, NULL, FALSE) != TokenEOF)
|
||||
ProgramFail(&Parser, "parse error");
|
||||
|
||||
HeapFree(Tokens);
|
||||
HeapFreeMem(Tokens);
|
||||
if (OldCleanupTokens == NULL)
|
||||
CleanupTokens = NULL;
|
||||
}
|
||||
|
|
4
picoc.h
4
picoc.h
|
@ -338,8 +338,8 @@ int HeapPopStack(void *Addr, int Size);
|
|||
void HeapUnpopStack(int Size);
|
||||
void HeapPushStackFrame();
|
||||
int HeapPopStackFrame();
|
||||
void *HeapAlloc(int Size);
|
||||
void HeapFree(void *Mem);
|
||||
void *HeapAllocMem(int Size);
|
||||
void HeapFreeMem(void *Mem);
|
||||
|
||||
/* variable.c */
|
||||
void VariableInit();
|
||||
|
|
4
table.c
4
table.c
|
@ -132,7 +132,7 @@ char *TableSetIdentifier(struct Table *Tbl, const char *Ident, int IdentLen)
|
|||
return &FoundEntry->p.Key[0];
|
||||
else
|
||||
{ /* add it to the table - we economise by not allocating the whole structure here */
|
||||
struct TableEntry *NewEntry = HeapAlloc(sizeof(struct TableEntry *) + IdentLen + 1);
|
||||
struct TableEntry *NewEntry = HeapAllocMem(sizeof(struct TableEntry *) + IdentLen + 1);
|
||||
if (NewEntry == NULL)
|
||||
ProgramFail(NULL, "out of memory");
|
||||
|
||||
|
@ -167,7 +167,7 @@ void TableStrFree()
|
|||
for (Entry = StringTable.HashTable[Count]; Entry != NULL; Entry = NextEntry)
|
||||
{
|
||||
NextEntry = Entry->Next;
|
||||
HeapFree(Entry);
|
||||
HeapFreeMem(Entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
4
type.c
4
type.c
|
@ -152,11 +152,11 @@ void TypeCleanupNode(struct ValueType *Typ)
|
|||
if (SubType->Members != NULL)
|
||||
{
|
||||
VariableTableCleanup(SubType->Members);
|
||||
HeapFree(SubType->Members);
|
||||
HeapFreeMem(SubType->Members);
|
||||
}
|
||||
|
||||
/* free this node */
|
||||
HeapFree(SubType);
|
||||
HeapFreeMem(SubType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
12
variable.c
12
variable.c
|
@ -27,14 +27,14 @@ void VariableFree(struct Value *Val)
|
|||
{
|
||||
/* free function bodies */
|
||||
if (Val->Typ == &FunctionType && Val->Val->FuncDef.Intrinsic == NULL)
|
||||
HeapFree((void *)Val->Val->FuncDef.Body.Pos);
|
||||
HeapFreeMem((void *)Val->Val->FuncDef.Body.Pos);
|
||||
|
||||
/* free macro bodies */
|
||||
if (Val->Typ == &MacroType)
|
||||
HeapFree((void *)Val->Val->Parser.Pos);
|
||||
HeapFreeMem((void *)Val->Val->Parser.Pos);
|
||||
|
||||
/* free the value */
|
||||
HeapFree(Val);
|
||||
HeapFreeMem(Val);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ void VariableTableCleanup(struct Table *HashTable)
|
|||
VariableFree(Entry->p.v.Val);
|
||||
|
||||
/* free the hash table entry */
|
||||
HeapFree(Entry);
|
||||
HeapFreeMem(Entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void *VariableAlloc(struct ParseState *Parser, int Size, int OnHeap)
|
|||
void *NewValue;
|
||||
|
||||
if (OnHeap)
|
||||
NewValue = HeapAlloc(Size);
|
||||
NewValue = HeapAllocMem(Size);
|
||||
else
|
||||
NewValue = HeapAllocStack(Size);
|
||||
|
||||
|
@ -217,7 +217,7 @@ void VariableStackPop(struct ParseState *Parser, struct Value *Var)
|
|||
if (Var->ValOnHeap)
|
||||
{
|
||||
if (Var->Val != NULL)
|
||||
HeapFree(Var->Val);
|
||||
HeapFreeMem(Var->Val);
|
||||
|
||||
Success = HeapPopStack(Var, sizeof(struct Value)); /* free from heap */
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue