Skip to content
Snippets Groups Projects
Commit a1bf3861 authored by Christian Engwer's avatar Christian Engwer
Browse files

[heap] rename functions allocating tagged memory to reflect the purpose of temporary memory

parent 8b9c84f6
No related branches found
No related tags found
1 merge request!94Feature/enforce dynamic memory allocmodel
......@@ -2113,7 +2113,7 @@ INT NS_DIM_PREFIX NEW_Write_RefRules (MULTIGRID *mg, INT RefRuleOffset[], INT Ma
REP_ERR_RETURN(1);
global.heap = MGHEAP(mg);
if (Mark(global.heap,&BotMarkKey))
if (MarkTmpMem(global.heap,&BotMarkKey))
REP_ERR_RETURN(1);
/* init rule counters (continue with last rule IDs of rm) */
......@@ -2174,7 +2174,7 @@ INT NS_DIM_PREFIX NEW_Write_RefRules (MULTIGRID *mg, INT RefRuleOffset[], INT Ma
Write_RR_Rules(global.maxrules,*mrule_handle);
/* free hrules and hrule table */
if (Release(global.heap,BotMarkKey))
if (ReleaseTmpMem(global.heap,BotMarkKey))
REP_ERR_RETURN(1);
IFDEBUG(gm,ER_DBG_GENERAL)
......
......@@ -174,7 +174,7 @@ void *NS_PREFIX GetMem (HEAP *theHeap, MEM n)
/****************************************************************************/
void *NS_PREFIX GetMemUsingKey (HEAP *theHeap, MEM n, INT key)
void *NS_PREFIX GetTmpMem (HEAP *theHeap, MEM n, INT key)
{
if (theHeap->type==SIMPLE_HEAP)
{
......@@ -259,7 +259,7 @@ INT NS_PREFIX PutFreelistMemory (HEAP *theHeap, void *object, INT size)
*/
/****************************************************************************/
INT NS_PREFIX Mark (HEAP *theHeap, INT *key)
INT NS_PREFIX MarkTmpMem (HEAP *theHeap, INT *key)
{
assert(theHeap->type==SIMPLE_HEAP);
if (theHeap->type!=SIMPLE_HEAP) return(1);
......@@ -286,7 +286,7 @@ INT NS_PREFIX Mark (HEAP *theHeap, INT *key)
*/
/****************************************************************************/
INT NS_PREFIX Release (HEAP *theHeap, INT key)
INT NS_PREFIX ReleaseTmpMem (HEAP *theHeap, INT key)
{
if (theHeap->type!=SIMPLE_HEAP) return 1;
......
......@@ -79,10 +79,6 @@ enum HeapAllocMode
FROM_BOTTOM=2 /**< Allocate from bottom of stack */
} DUNE_DEPRECATED;
#define MarkTmpMem(p,kp) Mark(p,kp)
#define GetTmpMem(p,n,k) GetMemUsingKey(p,n,k)
#define ReleaseTmpMem(p,k) Release(p,k)
/****************************************************************************/
/****************************************************************************/
/** @name Defines and macros for the virtual heap management */
......@@ -136,24 +132,25 @@ typedef struct {
/* @{ */
HEAP *NewHeap (enum HeapType type, MEM size, void *buffer);
void DisposeHeap (HEAP *theHeap);
void *GetMem (HEAP *theHeap, MEM n);
void *GetMemUsingKey (HEAP *theHeap, MEM n, INT key);
void DisposeMem (HEAP *theHeap, void *buffer);
void *GetFreelistMemory (HEAP *theHeap, INT size);
INT PutFreelistMemory (HEAP *theHeap, void *object, INT size);
INT Mark (HEAP *theHeap, INT *key);
INT Release (HEAP *theHeap, INT key);
INT MarkTmpMem (HEAP *theHeap, INT *key);
void *GetTmpMem (HEAP *theHeap, MEM n, INT key);
INT ReleaseTmpMem (HEAP *theHeap, INT key);
inline INT DUNE_DEPRECATED_MSG("Mark taking a mode is deprecated")
Mark (HEAP *theHeap, INT mode, INT *key)
{
return Mark(theHeap,key);
return MarkTmpMem(theHeap,key);
}
inline INT DUNE_DEPRECATED_MSG("Release taking a mode is deprecated")
Release (HEAP *theHeap, INT mode, INT key)
{
return Release(theHeap,key);
return ReleaseTmpMem(theHeap,key);
}
/* @} */
......
......@@ -430,13 +430,13 @@ int NS_DIM_PREFIX BalanceGridRCB (MULTIGRID *theMG, int level)
return (1);
}
Mark(theHeap,&MarkKey);
MarkTmpMem(theHeap,&MarkKey);
lbinfo = (LB_INFO *)
GetMemUsingKey(theHeap, NT(theGrid)*sizeof(LB_INFO), MarkKey);
GetTmpMem(theHeap, NT(theGrid)*sizeof(LB_INFO), MarkKey);
if (lbinfo==NULL)
{
Release(theHeap,MarkKey);
ReleaseTmpMem(theHeap,MarkKey);
UserWrite("ERROR in BalanceGridRCB: could not allocate memory from the MGHeap\n");
return (1);
}
......@@ -466,7 +466,7 @@ int NS_DIM_PREFIX BalanceGridRCB (MULTIGRID *theMG, int level)
InheritPartition (e);
}
Release(theHeap,MarkKey);
ReleaseTmpMem(theHeap,MarkKey);
}
return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment