本文整理汇总了C++中CMemFree函数的典型用法代码示例。如果您正苦于以下问题:C++ CMemFree函数的具体用法?C++ CMemFree怎么用?C++ CMemFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CMemFree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PragmaAuxFini
void PragmaAuxFini( void )
{
void *junk;
while( AuxList != NULL ) {
junk = AuxList;
if( AuxList->info != NULL ) {
if( AuxList->info->use > 1 ) {
AuxList->info->use--;
} else {
FreeAuxInfo( AuxList->info );
if( !IsAuxInfoBuiltIn( AuxList->info ) ) {
CMemFree( AuxList->info );
}
}
}
AuxList = AuxList->next;
CMemFree( junk );
}
FreeAuxInfo( &DefaultInfo );
FreeAuxInfo( &WatcallInfo );
FreeAuxInfo( &CdeclInfo );
FreeAuxInfo( &PascalInfo );
FreeAuxInfo( &SyscallInfo );
FreeAuxInfo( &OptlinkInfo );
FreeAuxInfo( &FortranInfo );
FreeAuxInfo( &StdcallInfo );
FreeAuxInfo( &FastcallInfo );
#if _CPU == 386
FreeAuxInfo( &Far16CdeclInfo );
FreeAuxInfo( &Far16PascalInfo );
#endif
}
示例2: freeAuxInfo
void freeAuxInfo( AUX_INFO *i ) // FREE ALL AUX INFO MEM
{
if( !IsAuxParmsBuiltIn( i->parms ) ) {
CMemFree( i->parms );
}
CMemFree( i->objname );
CMemFree( i->code );
}
示例3: createBrowseFile
static int createBrowseFile( FILE *browseFile )
{
char *ptr;
size_t bufsize;
int fileNum;
unsigned bufnum;
dw_out_offset sectionSize;
dw_out_offset sectionOffset[SECTION_COUNT];
// calculate sections data size
elf_header.e_shoff = sizeof( Elf32_Ehdr ) + sizeof( string_table );
for( fileNum = 0; fileNum < SECTION_COUNT; fileNum++ ) {
elf_header.e_shoff += dw_sections[inSect[fileNum]].length;
}
// write elf header
mywrite( browseFile, &elf_header, sizeof( elf_header ) );
// write string table
mywrite( browseFile, string_table, sizeof( string_table ) );
// calculate each of the sections, tracking offset
// write each of the sections
sectionOffset[0] = sizeof( elf_header ) + sizeof( string_table );
for( fileNum = 0; fileNum < SECTION_COUNT; fileNum++ ) {
if( fileNum > 0 )
sectionOffset[fileNum] = sectionOffset[fileNum - 1] + dw_sections[inSect[fileNum - 1]].length;
bufsize = C_DWARF_BUFSIZE;
bufnum = 0;
for( sectionSize = dw_sections[inSect[fileNum]].length; sectionSize > 0; sectionSize -= bufsize ) {
if( bufsize > sectionSize )
bufsize = sectionSize;
ptr = dw_sections[inSect[fileNum]].bufptrs[bufnum];
mywrite( browseFile, ptr, bufsize );
CMemFree( ptr );
++bufnum;
}
if( dw_sections[inSect[fileNum]].bufptrs != NULL ) {
CMemFree( dw_sections[inSect[fileNum]].bufptrs );
}
}
// write section_header_index0
mywrite( browseFile, §ion_header_index0, sizeof( section_header_index0 ) );
// write section_header_string_table
mywrite( browseFile, §ion_header_string_table, sizeof( section_header_string_table ) );
// write rest of section headers
for( fileNum = 0; fileNum < SECTION_COUNT; fileNum++ ) {
section_header_template.sh_name = string_table_offsets[fileNum];
section_header_template.sh_offset = sectionOffset[fileNum];
section_header_template.sh_size = dw_sections[inSect[fileNum]].length;
mywrite( browseFile, §ion_header_template, sizeof( section_header_template ) );
}
return( 0 );
}
示例4: FreeUndefNames
static void FreeUndefNames( void )
{
undef_names *uname;
for( ; (uname = UndefNames) != NULL; ) {
UndefNames = uname->next;
CMemFree( uname->name );
CMemFree( uname );
}
}
示例5: PragEnding
void PragEnding( // PROCESS END OF PRAGMA
bool set_sym ) // - true ==> set SYMBOL's aux_info
{
if( CurrEntry != NULL ) {
if( CurrAlias != NULL ) {
CurrInfo->use = CurrAlias->use;
if( memcmp( CurrAlias, CurrInfo, sizeof( AUX_INFO ) ) == 0 ) {
CurrEntry->info = CurrAlias;
CurrAlias->use++;
CMemFree( CurrInfo );
} else {
copyParms();
AsmSysCopyCode();
copyObjName();
CurrInfo->use = 1;
CurrEntry->info = CurrInfo;
}
}
CurrEntry->next = AuxList;
AuxList = CurrEntry;
if( set_sym ) {
ScopeAuxName( CurrEntry->name, CurrEntry->info );
}
}
}
示例6: AdvanceToken
static void AdvanceToken( void )
/******************************/
{
CMemFree( SavedId );
SavedId = NULL;
CurToken = LAToken;
}
示例7: DumpFuncDefn
void DumpFuncDefn( void )
{
TYPEPTR typ;
FNAMEPTR flist;
STRCHUNK chunk;
char *result;
typ = CurFunc->sym_type;
DumpParmTags( typ->u.fn.parms, DefFile );
flist = FileIndexToFName( CurFunc->src_loc.fno );
fprintf( DefFile, "//#line \"%s\" %u\n",
flist->name,
CurFunc->src_loc.line );
ChunkInit( &chunk );
if( CurFunc->attribs.stg_class == SC_STATIC ) {
put_keyword( T_STATIC, &chunk );
} else {
put_keyword( T_EXTERN, &chunk );
}
if( CurFunc->flags & SYM_TYPE_GIVEN ) {
DumpBaseType( Object( typ ), &chunk );
}
DumpDecl( typ, CurFunc, &chunk );
result = ChunkToStr( &chunk );
fprintf( DefFile, "%s;\n", result );
CMemFree( result );
}
示例8: PragDataSeg
static void PragDataSeg( void ) /* 22-oct-92 */
/*****************************/
{
char *segname;
segment_id segment;
if( CurToken == T_LEFT_PAREN ) {
PPCTL_ENABLE_MACROS();
segment = 0;
NextToken();
if( ( CurToken == T_STRING ) || ( CurToken == T_ID ) ) {
segname = CStrSave( Buffer );
NextToken();
if( CurToken == T_COMMA ) {
NextToken();
if( ( CurToken == T_STRING ) || ( CurToken == T_ID ) ) {
segment = AddSegName( segname, Buffer, SEGTYPE_DATA );
NextToken();
} else {
segment = AddSegName( segname, NULL, SEGTYPE_DATA );
}
} else {
segment = AddSegName( segname, NULL, SEGTYPE_DATA );
}
CMemFree( segname );
}
PPCTL_DISABLE_MACROS();
MustRecog( T_RIGHT_PAREN );
DefDataSegment = segment;
}
}
示例9: getPackArgs
local void getPackArgs( void )
/****************************/
{
struct pack_info *pi;
/* check to make sure it is a numeric token */
if( PragIdRecog( "push" ) ) { /* 29-sep-94 */
pi = (struct pack_info *)CMemAlloc( sizeof( struct pack_info ) );
pi->next = PackInfo;
pi->pack_amount = PackAmount;
PackInfo = pi;
if( CurToken == T_COMMA ) {
PPCTL_ENABLE_MACROS();
NextToken();
PPCTL_DISABLE_MACROS();
if( ExpectingConstant() ) {
SetPackAmount();
}
NextToken();
}
} else if( PragIdRecog( "pop" ) ) {
pi = PackInfo;
if( pi != NULL ) {
PackAmount = pi->pack_amount;
PackInfo = pi->next;
CMemFree( pi );
}
} else {
CErr1( ERR_NOT_A_CONSTANT_EXPR );
}
}
示例10: ChunkSaveData
static void ChunkSaveData( STRCHUNK *pch, const char *data, size_t len )
{
int bytesleft;
int requestbytes;
char *newdata;
bytesleft = pch->maxsize - (pch->cursize+len+1);
if( bytesleft <= 0 ) {
requestbytes = -bytesleft;
if( requestbytes < STRCHUNK_INCREMENT ) {
requestbytes = STRCHUNK_INCREMENT;
}
requestbytes += pch->maxsize;
newdata = CMemAlloc( requestbytes );
if( pch->data ) {
memcpy( newdata, pch->data, pch->cursize );
CMemFree( pch->data );
}
pch->data = newdata;
pch->maxsize = requestbytes;
}
memcpy( pch->data+pch->cursize, data, len );
pch->cursize += len;
pch->data[pch->cursize] = '\0';
}
示例11: PragManyRegSets
void PragManyRegSets( // GET PRAGMA REGISTER SETS
void )
{
hw_reg_set buff[ MAXIMUM_PARMSETS ];
int i;
hw_reg_set list;
hw_reg_set *sets;
list = PragRegList();
i = 0;
while( !HW_CEqual( list, HW_EMPTY ) && ( i != MAXIMUM_PARMSETS ) ) {
buff[ i++ ] = list;
list = PragRegList();
}
if( !HW_CEqual( list, HW_EMPTY ) ) {
CErr1( ERR_TOO_MANY_PARM_SETS );
}
HW_CAsgn( buff[i], HW_EMPTY );
i++;
i *= sizeof( hw_reg_set );
sets = ( hw_reg_set * ) CMemAlloc( i );
memcpy( sets, buff, i );
if( !IsAuxParmsBuiltIn( CurrInfo->parms ) ) {
CMemFree( CurrInfo->parms );
}
CurrInfo->parms = sets;
}
示例12: CMemAlloc
void *SafeRecurseCpp( func_sr rtn, void *arg )
/********************************************/
/* This code assumes NO parameters on the stack! */
{
#define SAVE_SIZE 512 /* this must be smaller than the stack */
void *savearea;
void *retval;
if( stackavail() < 0x2000 ) { /* stack getting low! */
savearea = CMemAlloc( SAVE_SIZE );
if( savearea != NULL ) {
memcpy( bp(), savearea, SAVE_SIZE );
memcpy( sp(), sp() + SAVE_SIZE, bp() - sp() );
setbp( bp() + SAVE_SIZE );
setsp( sp() + SAVE_SIZE );
retval = rtn( arg );
setsp( sp() - SAVE_SIZE );
memcpy( sp() + SAVE_SIZE, sp(), bp() - sp() - SAVE_SIZE );
setbp( bp() - SAVE_SIZE );
memcpy( savearea, bp(), SAVE_SIZE );
CMemFree( savearea );
return( retval );
}
}
return( rtn( arg ) );
}
示例13: setTarget
static void setTarget( char **n, char *t )
{
if( *n ) {
CMemFree( *n );
}
*n = strupr( t );
}
示例14: pragmaFini
static void pragmaFini( // FINISH PRAGMAS
INITFINI* defn ) // - definition
{
AUX_ENTRY *next;
AUX_ENTRY *curr;
AUX_INFO *info;
defn = defn;
for( curr = AuxList; curr != NULL; curr = next ) {
next = curr->next;
info = curr->info;
if( info != NULL ) {
if( info->use > 1 ) {
info->use--;
} else {
freeInfo( info );
#ifndef NDEBUG
if( IsAuxInfoBuiltIn( info ) ) {
CFatal( "freeing a static calling convention info" );
}
#endif
if( !IsAuxInfoBuiltIn( info ) ) {
CMemFree( info );
}
}
}
CMemFree( curr );
}
freeInfo( &DefaultInfo );
freeInfo( &CdeclInfo );
freeInfo( &PascalInfo );
freeInfo( &SyscallInfo );
freeInfo( &OptlinkInfo );
freeInfo( &StdcallInfo );
freeInfo( &FastcallInfo );
#if _CPU == 386
freeInfo( &Far16CdeclInfo );
freeInfo( &Far16PascalInfo );
#endif
freeInfo( &WatcallInfo );
freeInfo( &FortranInfo );
//CMemFreePtr( &FortranInfo.objname );
AuxList = NULL;
CgInfoFreeLibs();
CgInfoFreeImports();
CgInfoFreeImportsS();
}
示例15: pragIncludeAlias
// form: #pragma include_alias( "alias_name", "real_name" )
// #pragma include_alias( <alias_name>, <real_name> )
//
// (1) causes include directives referencing alias_name to refer
// to real_name instead
//
static void pragIncludeAlias( void )
{
if( ExpectingToken( T_LEFT_PAREN ) ) {
PPCTL_ENABLE_MACROS();
NextToken();
if( CurToken == T_STRING ) {
char *alias_name;
alias_name = CMemAlloc( strlen( Buffer ) + 1 );
strcpy( alias_name, Buffer );
NextToken();
if( ExpectingToken( T_COMMA ) ) {
NextToken();
}
if( CurToken == T_STRING ) {
IAliasAdd( alias_name, Buffer, false );
NextToken();
}
CMemFree( alias_name );
} else if( CurToken == T_LT ) {
char a_buf[82];
char r_buf[82];
a_buf[0] = '\0';
for( ;; ) {
NextToken();
if( CurToken == T_GT ) {
NextToken();
break;
}
if( CurToken == T_NULL ) {
break;
}
strncat( a_buf, Buffer, sizeof( a_buf ) - 2 );
}
if( ExpectingToken( T_COMMA ) ) {
NextToken();
}
if( CurToken == T_LT ) {
r_buf[0] = '\0';
for( ;; ) {
NextToken();
if( CurToken == T_GT ) {
NextToken();
break;
}
if( CurToken == T_NULL ) {
break;
}
strncat( r_buf, Buffer, sizeof( r_buf ) - 2 );
}
IAliasAdd( a_buf, r_buf, true );
}
}
PPCTL_DISABLE_MACROS();
MustRecog( T_RIGHT_PAREN );
}
}