本文整理汇总了C++中CMemFree函数的典型用法代码示例。如果您正苦于以下问题:C++ CMemFree函数的具体用法?C++ CMemFree怎么用?C++ CMemFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CMemFree函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:34,代码来源:caux.c
示例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 );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:8,代码来源:caux.c
示例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 );
}
开发者ID:ArmstrongJ,项目名称:open-watcom-v2,代码行数:57,代码来源:browsio.c
示例4: FreeUndefNames
static void FreeUndefNames( void )
{
undef_names *uname;
for( ; (uname = UndefNames) != NULL; ) {
UndefNames = uname->next;
CMemFree( uname->name );
CMemFree( uname );
}
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:10,代码来源:cmodel.c
示例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 );
}
}
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:25,代码来源:cpragma.c
示例6: AdvanceToken
static void AdvanceToken( void )
/******************************/
{
CMemFree( SavedId );
SavedId = NULL;
CurToken = LAToken;
}
开发者ID:XVilka,项目名称:owp4v1copy,代码行数:7,代码来源:cpragx86.c
示例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 );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:30,代码来源:cdump.c
示例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;
}
}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:31,代码来源:cpragma.c
示例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 );
}
}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:31,代码来源:cpragma.c
示例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';
}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:25,代码来源:cdump.c
示例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;
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:27,代码来源:cpragma.c
示例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 ) );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:27,代码来源:stacksr.c
示例13: setTarget
static void setTarget( char **n, char *t )
{
if( *n ) {
CMemFree( *n );
}
*n = strupr( t );
}
开发者ID:andreiw,项目名称:open-watcom-v2,代码行数:7,代码来源:cmdlnany.c
示例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();
}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:47,代码来源:cpragx86.c
示例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 );
}
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:64,代码来源:cpragma.c
示例16: PragObjNameInfo
void PragObjNameInfo( // RECOGNIZE OBJECT NAME INFORMATION
void )
{
if( CurToken == T_STRING ) {
CMemFree( CurrInfo->objname );
CurrInfo->objname = strsave( Buffer );
NextToken();
}
}
开发者ID:Azarien,项目名称:open-watcom-v2,代码行数:9,代码来源:cpragma.c
示例17: dw_write
static void dw_write( dw_sectnum section, const void *block, dw_size_t len )
/********************************************************************/
{
unsigned bufnum;
unsigned endbufnum;
C_DW_SECTION *dwsect;
char **newbufptrs;
unsigned bufsize;
char *bufptr;
dwsect = &DWSections[section];
#ifdef __DD__
//int i;
printf( "\nDW_WRITE(%d:%d): offset: %d len: %d ",
section,
dwsect->length,
dwsect->offset,
len );
//for( i = 0 ; i < len; i++ ) {
// printf( "%02x ", (int)((char *)block)[i] );
//}
#endif
bufnum = dwsect->offset / C_DWARF_BUFSIZE;
endbufnum = (dwsect->offset + len) / C_DWARF_BUFSIZE;
if( endbufnum >= dwsect->bufcount ) {
newbufptrs = (char**)CMemAlloc( (endbufnum + 1) * sizeof(char**) );
if( dwsect->bufptrs != NULL ) {
memcpy( newbufptrs,
dwsect->bufptrs,
dwsect->bufcount * sizeof(char**) );
CMemFree( dwsect->bufptrs );
}
dwsect->bufptrs = newbufptrs;
dwsect->bufcount = endbufnum + 1;
}
bufsize = C_DWARF_BUFSIZE - (dwsect->offset % C_DWARF_BUFSIZE);
dwsect->offset += len;
if( dwsect->offset > dwsect->length ) {
dwsect->length = dwsect->offset;
}
while( len != 0 ) {
bufptr = dwsect->bufptrs[bufnum];
if( bufptr == NULL ) {
bufptr = (char *)CMemAlloc( C_DWARF_BUFSIZE );
dwsect->bufptrs[bufnum] = bufptr;
}
bufptr += C_DWARF_BUFSIZE - bufsize;
if( len < bufsize ) bufsize = len;
memcpy( bufptr, block, bufsize );
block = (char *)block + bufsize;
len -= bufsize;
++bufnum; // advance to next buffer
bufsize = C_DWARF_BUFSIZE; // buffer is full size
}
}
开发者ID:jossk,项目名称:open-watcom-v2,代码行数:55,代码来源:browsio.c
示例18: PCHReadPragmas
pch_status PCHReadPragmas( void )
{
unsigned size;
unsigned max_index;
unsigned entry_len;
unsigned index;
AUX_ENTRY *e;
AUX_ENTRY *f;
AUX_ENTRY *next_f;
AUX_INFO *info;
for( f = AuxList; f != NULL; f = next_f ) {
next_f = f->next;
freeAuxInfo( f->info );
CMemFree( f->info );
CMemFree( f );
}
max_index = PCHReadUInt();
size = max_index * sizeof( AUX_INFO * );
infoTranslate = CMemAlloc( size );
memset( infoTranslate, 0, size );
// read all aux_info
for( index = PCH_FIRST_INDEX; index < max_index; ++index ) {
if( index < PCH_FIRST_USER_INDEX ) {
info = BuiltinAuxInfo + index - PCH_FIRST_INDEX;
} else {
info = CMemAlloc( sizeof( AUX_INFO ) );
}
infoTranslate[index] = info;
readAuxInfo( info );
}
// read aux entries
AuxList = NULL;
for( ; (entry_len = PCHReadUInt()) != 0; ) {
e = CMemAlloc( offsetof( AUX_ENTRY, name ) + entry_len + 1 );
PCHRead( e->name, entry_len + 1 );
e->info = PragmaMapIndex( PCHSetUInt( PCHReadUInt() ) );
e->next = AuxList;
AuxList = e;
}
return( PCHCB_OK );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:42,代码来源:caux.c
注:本文中的CMemFree函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论