當前位置: 首頁>>代碼示例>>C++>>正文


C++ GetMemory函數代碼示例

本文整理匯總了C++中GetMemory函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetMemory函數的具體用法?C++ GetMemory怎麽用?C++ GetMemory使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GetMemory函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的GetMemory函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。