本文整理汇总了C++中GetMemory函数的典型用法代码示例。如果您正苦于以下问题:C++ GetMemory函数的具体用法?C++ GetMemory怎么用?C++ GetMemory使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMemory函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: sizeof
FILE* ON_Workspace::OpenFile( const wchar_t* sFileName, const wchar_t* sMode )
{
FILE* pFile = ON::OpenFile( sFileName, sMode );
if ( pFile )
{
struct ON_Workspace_FBLK* pFileBlk = (struct ON_Workspace_FBLK*)GetMemory( sizeof(*pFileBlk) );
pFileBlk->pNext = m_pFileBlk;
pFileBlk->pFile = pFile;
m_pFileBlk = pFileBlk;
}
return pFile;
}
开发者ID:ToMadoRe,项目名称:v4r,代码行数:12,代码来源:opennurbs_workspace.cpp
示例2: GetProtocolFactory
//删除协议上下文
void IAppInterface::DeleteProtocolContext(ProtocolContext *context)
{
//释放protocol实例
IProtocolFactory *factory = GetProtocolFactory();
if(context->protocol != NULL)
factory->DeleteProtocol(context->protocol_type, context->protocol);
IMemory *memory = GetMemory();
assert(context!=NULL);
context->~ProtocolContext();
memory->Free((void*)context, sizeof(ProtocolContext));
}
开发者ID:qqonline,项目名称:EasyNetFramework,代码行数:13,代码来源:IAppInterface.cpp
示例3: GetMemory
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
node_t *AllocNode (void)
{
node_t *node;
node = GetMemory(sizeof(*node));
memset (node, 0, sizeof(*node));
if (numthreads == 1)
{
c_nodememory += MemorySize(node);
} //end if
return node;
} //end of the function AllocNode
开发者ID:Garux,项目名称:netradiant-custom,代码行数:18,代码来源:brushbsp.c
示例4: GetMemoryDebug
void *GetClearedMemory(unsigned long size)
#endif //MEMDEBUG
{
void *ptr;
#ifdef MEMDEBUG
ptr = GetMemoryDebug(size, label, file, line);
#else
ptr = GetMemory(size);
#endif //MEMDEBUG
memset(ptr, 0, size);
return ptr;
}
开发者ID:Ponce,项目名称:etlegacy,代码行数:12,代码来源:l_memory.c
示例5: l
void InternalAllocator::ReleaseAllMemory()
{
std::lock_guard<std::mutex> l(m_PagesMutex);
// walk all pages backwards and kill them
Page* next = m_Tail;
while(next) {
auto current = next;
next = current->GetPrevious();
current->~Page();
m_ExternalAllocator->Deallocate(current->GetMemory());
}
}
开发者ID:thameera,项目名称:profi,代码行数:12,代码来源:Registry.cpp
示例6: GetMemory
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
libvar_t *LibVarAlloc( char *var_name ) {
libvar_t *v;
v = (libvar_t *) GetMemory( sizeof( libvar_t ) + strlen( var_name ) + 1 );
memset( v, 0, sizeof( libvar_t ) );
v->name = (char *) v + sizeof( libvar_t );
strcpy( v->name, var_name );
//add the variable in the list
v->next = libvarlist;
libvarlist = v;
return v;
} //end of the function LibVarAlloc
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:18,代码来源:l_libvar.c
示例7: InitUndo
/*
Alloc UNDO/REDO structures
*/
void InitUndo()
{
// Check MaxUndo global var.
if ( MaxUndo < 1 ) MaxUndo = 1;
// Allocates MaxUndo+1 entries
if ( UndoArray == NULL )
UndoArray = (UndoData *)GetMemory (MaxUndo * sizeof(UndoData));
NbUndo = 0;
NextUndo = -1;
}
开发者ID:Anonic,项目名称:Meridian59,代码行数:17,代码来源:undo.cpp
示例8: GetLink
/**************************************************************
功能:从 src 中分析出网页链接,并加入到当前节点的子节点上
***************************************************************/
void GetLink(char * src)
{
char * pa, * pb, * pc;
char * myanchor = 0;
int len = 0;
pa = src;
do
{
if((pb = strstr(pa, "href='")))
{
pc = strchr(pb + 6, '\'');
len = strlen(pb + 6) - strlen(pc);
GetMemory(&myanchor, len);
memcpy(myanchor, pb + 6, len);
}
else if((pb = strstr(pa, "href=\"")))
{
pc = strchr(pb + 6, '"');
len = strlen(pb + 6) - strlen(pc);
GetMemory(&myanchor, len);
memcpy(myanchor, pb + 6, len);
}
else if((pb = strstr(pa, "href=")))
{
GetAfterPosWithSlash(pb + 5, &pc);
len = strlen(pb + 5) - strlen(pc);
GetMemory(&myanchor, len);
memcpy(myanchor, pb + 5, len);
}
else {goto __returnLink ;}
if(strlen(myanchor) > 0)
AddChildNode(NodeCurr, myanchor);
if(pc + 1)
pa = pc + 1;
}while(pa);
__returnLink:
return;
}
开发者ID:landisliu,项目名称:project,代码行数:43,代码来源:worm2.c
示例9: GetLink
/**************************************************************
功能:从 src 中分析出网页链接,并加入到当前节点的子节点上
***************************************************************/
void GetLink(char * src)
{
char * pa, * pb, * pc;
char * myanchor = 0;
int len = 0;
pa = src;
do {
if((pb = strstr(pa, "href='"))) {
pc = strchr(pb + 6, '\'');
len = strlen(pb + 6) - strlen(pc);
GetMemory(&myanchor, len);
memcpy(myanchor, pb + 6, len);
}
else if((pb = strstr(pa, "href=\""))) {
pc = strchr(pb + 6, '"');
len = strlen(pb + 6) - strlen(pc);
GetMemory(&myanchor, len);
memcpy(myanchor, pb + 6, len);
}
else if((pb = strstr(pa, "href="))) {
GetAfterPosWithSlash(pb + 5, &pc);
len = strlen(pb + 5) - strlen(pc);
GetMemory(&myanchor, len);
memcpy(myanchor, pb + 5, len);
}
else {goto __returnLink ;}
/*
if(DEBUG) {
if(strcmp(NodeCurr->dir, "/")) fprintf(stdout, "%s\thttp://%s/%s/%s\n", myanchor, NodeCurr->host, NodeCurr->dir, strcmp(NodeCurr->page, "`")?NodeCurr->page:"");
else fprintf(stdout, "%s\thttp://%s%s%s\n", myanchor, NodeCurr->host, NodeCurr->dir, strcmp(NodeCurr->page, "`")?NodeCurr->page:"");
}
*/
if(strlen(myanchor) > 0) AddChildNode(NodeCurr, myanchor);
if(pc + 1) pa = pc + 1;
}while(pa);
__returnLink:
return;
}
开发者ID:lumia70,项目名称:unp,代码行数:42,代码来源:mail_spider.cpp
示例10: AAS_UpdateStringIndexes
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_UpdateStringIndexes( int numconfigstrings, char *configstrings[] ) {
int i;
//set string pointers and copy the strings
for ( i = 0; i < numconfigstrings; i++ )
{
if ( configstrings[i] ) {
//if ((*aasworld).configstrings[i]) FreeMemory((*aasworld).configstrings[i]);
( *aasworld ).configstrings[i] = (char *) GetMemory( strlen( configstrings[i] ) + 1 );
strcpy( ( *aasworld ).configstrings[i], configstrings[i] );
} //end if
} //end for
( *aasworld ).indexessetup = qtrue;
} //end of the function AAS_UpdateStringIndexes
开发者ID:rfc1459,项目名称:RTCW-SP,代码行数:19,代码来源:be_aas_main.c
示例11: AddThread
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AddThread( void ( *func )(int) ) {
thread_t *thread;
if ( numthreads == 1 ) {
if ( currentnumthreads >= numthreads ) {
return;
}
currentnumthreads++;
func( -1 );
currentnumthreads--;
} //end if
else
{
ThreadLock();
if ( currentnumthreads >= numthreads ) {
ThreadUnlock();
return;
} //end if
//allocate new thread
thread = GetMemory( sizeof( thread_t ) );
if ( !thread ) {
Error( "can't allocate memory for thread\n" );
}
//
thread->threadid = currentthreadid;
thread->handle = CreateThread(
NULL, // LPSECURITY_ATTRIBUTES lpsa,
0, // DWORD cbStack,
(LPTHREAD_START_ROUTINE)func, // LPTHREAD_START_ROUTINE lpStartAddr,
(LPVOID) thread->threadid, // LPVOID lpvThreadParm,
0, // DWORD fdwCreate,
&thread->id );
//add the thread to the end of the list
thread->next = NULL;
if ( lastthread ) {
lastthread->next = thread;
} else { firstthread = thread;}
lastthread = thread;
//
#ifdef THREAD_DEBUG
qprintf( "added thread with id %d\n", thread->threadid );
#endif //THREAD_DEBUG
//
currentnumthreads++;
currentthreadid++;
//
ThreadUnlock();
} //end else
} //end of the function AddThread
开发者ID:AdrienJaguenet,项目名称:Enemy-Territory,代码行数:57,代码来源:l_threads.c
示例12: FindFileInPak
//===========================================================================
// returns pointer to file handle
// sets offset to and length of 'filename' in the pak file
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
qboolean FindFileInPak( char *pakfile, char *filename, foundfile_t *file ) {
FILE *fp;
dpackheader_t packheader;
dpackfile_t *packfiles;
int numdirs, i;
char path[MAX_PATH];
//open the pak file
fp = fopen( pakfile, "rb" );
if ( !fp ) {
return false;
} //end if
//read pak header, check for valid pak id and seek to the dir entries
if ( ( fread( &packheader, 1, sizeof( dpackheader_t ), fp ) != sizeof( dpackheader_t ) )
|| ( packheader.ident != IDPAKHEADER )
|| ( fseek( fp, LittleLong( packheader.dirofs ), SEEK_SET ) )
) {
fclose( fp );
return false;
} //end if
//number of dir entries in the pak file
numdirs = LittleLong( packheader.dirlen ) / sizeof( dpackfile_t );
packfiles = (dpackfile_t *) GetMemory( numdirs * sizeof( dpackfile_t ) );
//read the dir entry
if ( fread( packfiles, sizeof( dpackfile_t ), numdirs, fp ) != numdirs ) {
fclose( fp );
FreeMemory( packfiles );
return false;
} //end if
fclose( fp );
//
strcpy( path, filename );
ConvertPath( path );
//find the dir entry in the pak file
for ( i = 0; i < numdirs; i++ )
{
//convert the dir entry name
ConvertPath( packfiles[i].name );
//compare the dir entry name with the filename
if ( Q_strcasecmp( packfiles[i].name, path ) == 0 ) {
strcpy( file->filename, pakfile );
file->offset = LittleLong( packfiles[i].filepos );
file->length = LittleLong( packfiles[i].filelen );
FreeMemory( packfiles );
return true;
} //end if
} //end for
FreeMemory( packfiles );
return false;
} //end of the function FindFileInPak
开发者ID:JackalFrost,项目名称:RTCW-WSGF,代码行数:58,代码来源:l_utils.c
示例13: PS_CreatePunctuationTable
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void PS_CreatePunctuationTable(script_t *script, punctuation_t *punctuations)
{
int i;
punctuation_t *p, *lastp, *newp;
//get memory for the table
if (!script->punctuationtable)
{
script->punctuationtable = (punctuation_t **)
GetMemory(256 * sizeof(punctuation_t *));
}
memset(script->punctuationtable, 0, 256 * sizeof(punctuation_t *));
//add the punctuations in the list to the punctuation table
for (i = 0; punctuations[i].p; i++)
{
newp = &punctuations[i];
lastp = NULL;
//sort the punctuations in this table entry on length (longer punctuations first)
for (p = script->punctuationtable[(unsigned int) newp->p[0]]; p; p = p->next)
{
if (strlen(p->p) < strlen(newp->p))
{
newp->next = p;
if (lastp)
{
lastp->next = newp;
}
else
{
script->punctuationtable[(unsigned int) newp->p[0]] = newp;
}
break;
} //end if
lastp = p;
} //end for
if (!p)
{
newp->next = NULL;
if (lastp)
{
lastp->next = newp;
}
else
{
script->punctuationtable[(unsigned int) newp->p[0]] = newp;
}
} //end if
} //end for
} //end of the function PS_CreatePunctuationTable
开发者ID:BulldogDrummond,项目名称:etlegacy-mysql,代码行数:55,代码来源:l_script.c
示例14: GetMemory
struct Node *CreateNode(struct Seg *ts, const bbox_t bbox)
{
struct Node *tn;
struct Seg *rights = NULL;
struct Seg *lefts = NULL;
tn = GetMemory( sizeof( struct Node)); /* Create a node*/
DivideSegs(ts,&rights,&lefts,bbox); /* Divide node in two*/
num_nodes++;
tn->x = node_x; /* store node line info*/
tn->y = node_y;
tn->dx = node_dx;
tn->dy = node_dy;
FindLimits(lefts,tn->leftbox); /* Find limits of vertices */
if(IsItConvex(lefts)) /* Check lefthand side*/
{
if (verbosity > 1) Verbose("L");
tn->nextl = CreateNode(lefts,tn->leftbox); /* still segs remaining*/
tn->chleft = 0;
if (verbosity > 1) Verbose("\b");
}
else
{
tn->nextl = NULL;
tn->chleft = CreateSSector(lefts) | 0x8000;
}
FindLimits(rights, tn->rightbox); /* Find limits of vertices*/
if(IsItConvex(rights)) /* Check righthand side*/
{
if (verbosity > 1) Verbose("R");
tn->nextr = CreateNode(rights, tn->rightbox); /* still segs remaining*/
tn->chright = 0;
if (verbosity > 1) Verbose("\b");
}
else
{
tn->nextr = NULL;
tn->chright = CreateSSector(rights) | 0x8000;
}
return tn;
}
开发者ID:Nekrofage,项目名称:DoomRPi,代码行数:49,代码来源:makenode.c
示例15: GetMemory
void list<T>::push_back(T t)
{
void* mem = GetMemory(sizeof(node));
node* add = new (reinterpret_cast<yassl_pointer>(mem)) node(t);
if (tail_) {
tail_->next_ = add;
add->prev_ = tail_;
}
else
head_ = add;
tail_ = add;
++sz_;
}
开发者ID:0x00xw,项目名称:mysql-2,代码行数:15,代码来源:list.hpp
示例16: GetMemory
status_t BnMemory::Transact( uint32_t code,
SParcel& data,
SParcel* reply,
uint32_t flags)
{
if (code == kGetMemory) {
ssize_t offset, size;
sptr<IMemoryHeap> heap = GetMemory(&offset, &size);
reply->WriteBinder(heap->AsBinder());
reply->WriteInt32(offset);
reply->WriteInt32(size);
return B_OK;
}
return BBinder::Transact(code, data, reply, flags);
}
开发者ID:cambridgehackers,项目名称:openbinder-archive,代码行数:15,代码来源:Memory.cpp
示例17: SetKeyValue
void SetKeyValue( entity_t *ent, char *key, char *value ) {
epair_t *ep;
for ( ep = ent->epairs ; ep ; ep = ep->next )
if ( !strcmp( ep->key, key ) ) {
FreeMemory( ep->value );
ep->value = copystring( value );
return;
}
ep = GetMemory( sizeof( *ep ) );
ep->next = ent->epairs;
ent->epairs = ep;
ep->key = copystring( key );
ep->value = copystring( value );
}
开发者ID:D4edalus,项目名称:CoD4x_Server,代码行数:15,代码来源:l_bsp_ent.c
示例18: fopen_s
void Dlg_MemBookmark::ImportFromFile( std::string sFilename )
{
FILE* pFile = nullptr;
errno_t nErr = fopen_s( &pFile, sFilename.c_str(), "r" );
if ( pFile != nullptr )
{
Document doc;
doc.ParseStream( FileStream( pFile ) );
if ( !doc.HasParseError() )
{
if ( doc.HasMember( "Bookmarks" ) )
{
ClearAllBookmarks();
const Value& BookmarksData = doc[ "Bookmarks" ];
for ( SizeType i = 0; i < BookmarksData.Size(); ++i )
{
MemBookmark* NewBookmark = new MemBookmark();
wchar_t buffer[ 256 ];
swprintf_s ( buffer, 256, L"%s", Widen( BookmarksData[ i ][ "Description" ].GetString() ).c_str() );
NewBookmark->SetDescription ( buffer );
NewBookmark->SetAddress( BookmarksData[ i ][ "Address" ].GetUint() );
NewBookmark->SetType( BookmarksData[ i ][ "Type" ].GetInt() );
NewBookmark->SetDecimal( BookmarksData[ i ][ "Decimal" ].GetBool() );
NewBookmark->SetValue( GetMemory( NewBookmark->Address(), NewBookmark->Type() ) );
NewBookmark->SetPrevious ( NewBookmark->Value() );
AddBookmark ( NewBookmark );
AddBookmarkMap( NewBookmark );
}
if ( m_vBookmarks.size() > 0 )
PopulateList();
}
else
{
ASSERT ( " !Invalid Bookmark File..." );
MessageBox( nullptr, _T("Could not load properly. Invalid Bookmark file."), _T("Error"), MB_OK | MB_ICONERROR );
return;
}
}
fclose( pFile );
}
}
开发者ID:SyrianBallaS,项目名称:RASuite,代码行数:48,代码来源:RA_Dlg_MemBookmark.cpp
示例19: TRACE
//////////////////////////////////////////////////////////
// TMapDC
// ------
// Initialize GDI pen cache
void
TMapDC::InitCacheData()
{
TRACE ("TMapDC::InitCacheData called");
if ( LastPens == NULL )
{
LastPens = (TPenColor16 **)GetMemory (COLOR16_CACHE_SIZE * sizeof (TPenColor16 *));
for (int i = 0 ; i < COLOR16_CACHE_SIZE ; i++)
{
LastPens[i] = 0;
}
atexit (CleanupCacheData);
}
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:20,代码来源:mapdc.cpp
示例20: Q3_CopyLump
/*
=============
Q3_CopyLump
=============
*/
int Q3_CopyLump( dheader_t *header, int lump, void **dest, int size ) {
int length, ofs;
length = header->lumps[lump].filelen;
ofs = header->lumps[lump].fileofs;
if ( length % size ) {
Error ("Q3_LoadBSPFile: odd lump size");
}
*dest = GetMemory(length);
memcpy( *dest, (byte *)header + ofs, length );
return length / size;
}
开发者ID:tkmorris,项目名称:OpenMOHAA,代码行数:21,代码来源:l_bsp_q3.c
注:本文中的GetMemory函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论