• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ M_Malloc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中M_Malloc函数的典型用法代码示例。如果您正苦于以下问题:C++ M_Malloc函数的具体用法?C++ M_Malloc怎么用?C++ M_Malloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了M_Malloc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1:

static FDoubleProd *NewDoubleProd (double val)
{
	FDoubleProd *prod = (FDoubleProd *)M_Malloc (sizeof(FDoubleProd));
	prod->Type = PROD_Double;
	prod->Value = val;
	return prod;
}
开发者ID:Accusedbold,项目名称:zdoom,代码行数:7,代码来源:c_expr.cpp


示例2: InitializeActorInfo

// This is used by DECORATE to assign ActorInfos to internal classes
void PClass::InitializeActorInfo ()
{
	Symbols.SetParentTable (&ParentClass->Symbols);
	Defaults = (BYTE *)M_Malloc(Size);
	if (ParentClass->Defaults != NULL) 
	{
		memcpy (Defaults, ParentClass->Defaults, ParentClass->Size);
		if (Size > ParentClass->Size)
		{
			memset (Defaults + ParentClass->Size, 0, Size - ParentClass->Size);
		}
	}
	else
	{
		memset (Defaults, 0, Size);
	}

	FActorInfo *info = ActorInfo = new FActorInfo;
	info->Class = this;
	info->GameFilter = GAME_Any;
	info->SpawnID = 0;
	info->DoomEdNum = -1;
	info->OwnedStates = NULL;
	info->NumOwnedStates = 0;
	info->Replacement = NULL;
	info->Replacee = NULL;
	info->StateList = NULL;
	info->DamageFactors = NULL;
	info->PainChances = NULL;
	info->PainFlashes = NULL;
	info->ColorSets = NULL;
	info->ScoreOnDeath = 0;
	m_RuntimeActors.Push (this);
}
开发者ID:RusselCS,项目名称:TheEntireGreekAlphabet,代码行数:35,代码来源:dobjtype.cpp


示例3: CreateStateLabelList

static FStateLabels * CreateStateLabelList(TArray<FStateDefine> & statelist)
{
	// First delete all empty labels from the list
	for (int i=statelist.Size()-1;i>=0;i--)
	{
		if (statelist[i].Label == NAME_None || (statelist[i].State == NULL && statelist[i].Children.Size() == 0))
		{
			statelist.Delete(i);
		}
	}

	int count=statelist.Size();

	if (count == 0) return NULL;

	FStateLabels * list = (FStateLabels*)M_Malloc(sizeof(FStateLabels)+(count-1)*sizeof(FStateLabel));
	list->NumLabels = count;

	for (int i=0;i<count;i++)
	{
		list->Labels[i].Label = statelist[i].Label;
		list->Labels[i].State = statelist[i].State;
		list->Labels[i].Children = CreateStateLabelList(statelist[i].Children);
	}
	qsort(list->Labels, count, sizeof(FStateLabel), labelcmp);
	return list;
}
开发者ID:ddraigcymraeg,项目名称:gzscoredoom,代码行数:27,代码来源:thingdef_states.cpp


示例4: FindString

void FStringTable::SetString (const char *name, const char *newString)
{
	StringEntry **pentry, *oentry;
	FindString (name, pentry, oentry);

	size_t newlen = strlen (newString);
	size_t namelen = strlen (name);

	// Create a new string entry
	StringEntry *entry = (StringEntry *)M_Malloc (sizeof(*entry) + newlen + namelen);
	strcpy (entry->String, newString);
	strcpy (entry->Name = entry->String + newlen + 1, name);
	entry->PassNum = 0;

	// If this is a new string, insert it. Otherwise, replace the old one.
	if (oentry == NULL)
	{
		entry->Next = *pentry;
		*pentry = entry;
	}
	else
	{
		*pentry = entry;
		entry->Next = oentry->Next;
		M_Free (oentry);
	}
}
开发者ID:Xeomuz,项目名称:Doom-Port-Source-Code,代码行数:27,代码来源:stringtable.cpp


示例5: DENG_ASSERT

ddstring_t *Str_Prepend(ddstring_t *str, char const *prepend)
{
    char *copied;
    size_t incoming;

    DENG_ASSERT(str);
    DENG_ASSERT(prepend);

    if(!str || !prepend) return str;

    incoming = strlen(prepend);
    if(incoming == 0)
        return str;

    copied = M_Malloc(incoming);
    memcpy(copied, prepend, incoming);

    allocateString(str, str->length + incoming, true);
    memmove(str->str + incoming, str->str, str->length + 1);
    memcpy(str->str, copied, incoming);
    str->length += incoming;

    M_Free(copied);
    return str;
}
开发者ID:gnuzinho,项目名称:Doomsday-Engine,代码行数:25,代码来源:str.c


示例6: M_Malloc

Rect *Rect_New(void)
{
    Rect *r = M_Malloc(sizeof *r);
    r->origin = Point2_New();
    r->size = Size2_New();
    return r;
}
开发者ID:gnuzinho,项目名称:Doomsday-Engine,代码行数:7,代码来源:rect.c


示例7: ModuleInstall_Stddev

//----初始化标准输入模块-------------------------------------------------------
//功能: 初始化标准输入模块,执行初始化后,可以创建输入设备。
//参数: 无
//返回: true = 成功,false= 失败.
//-----------------------------------------------------------------------------
bool_t ModuleInstall_Stddev(ptu32_t para)
{
    static struct  tagStdinDeviceRsc root;

    tg_pStdinInputMsgQ = Stddev_CreatInputMsgQ(10,"StdInDev");
    if(tg_pStdinInputMsgQ == NULL)
        return false;
    g_ptStdinDevice = M_Malloc(gc_u32CfgStdinDeviceLimit
                                * sizeof(struct  tagStdinDeviceRsc),0);
    if(g_ptStdinDevice == NULL)
    {
        Stddev_DeleteInputMsgQ(tg_pStdinInputMsgQ);
        return false;
    }
    s_ptStdinDeviceRscTree = (struct  tagStdinDeviceRsc *)
                        Rsc_AddTree(&root.stdin_device_node,
                        sizeof(struct  tagStdinDeviceRsc),RSC_STDIN_OUT,"stdin input device");
    //初始化泛设备控制块内存池
    g_ptStdinDevicePool = Mb_CreatePool((void*)g_ptStdinDevice,
                                    gc_u32CfgStdinDeviceLimit,
                                    sizeof(struct  tagStdinDeviceRsc),
                                    2,10,
                                    "输入设备控制块内存池");
    Stddev_SetFocusDefault(tg_pStdinInputMsgQ);
    return true;
}
开发者ID:Mars-Wu,项目名称:djyos,代码行数:31,代码来源:stddev.c


示例8: sizeof

FMemArena::Block *FMemArena::AddBlock(size_t size)
{
	Block *mem, **last;
	size += sizeof(Block);		// Account for header size

	// Search for a free block to use
	for (last = &FreeBlocks, mem = FreeBlocks; mem != NULL; last = &mem->NextBlock, mem = mem->NextBlock)
	{
		if ((BYTE *)mem->Limit - (BYTE *)mem >= (ptrdiff_t)size)
		{
			*last = mem->NextBlock;
			break;
		}
	}
	if (mem == NULL)
	{
		// Allocate a new block
		if (size < BlockSize)
		{
			size = BlockSize;
		}
		else
		{ // Stick some free space at the end so we can use this block for
		  // other things.
			size += BlockSize/2;
		}
		mem = (Block *)M_Malloc(size);
		mem->Limit = (BYTE *)mem + size;
	}
	mem->Reset();
	mem->NextBlock = TopBlock;
	TopBlock = mem;
	return mem;
}
开发者ID:dwing4g,项目名称:gzdoom,代码行数:34,代码来源:memarena.cpp


示例9: Alloc

void FRemapTable::Alloc(int count)
{
	Remap = (BYTE *)M_Malloc(count*sizeof(*Remap) + count*sizeof(*Palette));
	assert (Remap != NULL);
	Palette = (PalEntry *)(Remap + count*(sizeof(*Remap)));
	Native = NULL;
	NumEntries = count;
}
开发者ID:Accusedbold,项目名称:zdoom,代码行数:8,代码来源:r_translate.cpp


示例10: LOG_AS

size_t Zip::readLump(int lumpIdx, uint8_t* buffer, size_t startOffset,
                     size_t length, bool tryCache)
{
    LOG_AS("Zip::readLump");
    ZipFile const& file = reinterpret_cast<ZipFile&>(lump(lumpIdx));

    LOG_TRACE("\"%s:%s\" (%u bytes%s) [%u +%u]")
            << de::NativePath(composePath()).pretty()
            << de::NativePath(file.composePath()).pretty()
            << (unsigned long) file.size()
            << (file.isCompressed()? ", compressed" : "")
            << startOffset
            << length;

    // Try to avoid a file system read by checking for a cached copy.
    if(tryCache)
    {
        uint8_t const* data = d->lumpCache? d->lumpCache->data(lumpIdx) : 0;
        LOG_TRACE("Cache %s on #%i") << (data? "hit" : "miss") << lumpIdx;
        if(data)
        {
            size_t readBytes = MIN_OF(file.size(), length);
            memcpy(buffer, data + startOffset, readBytes);
            return readBytes;
        }
    }

    size_t readBytes;
    if(!startOffset && length == file.size())
    {
        // Read it straight to the caller's data buffer.
        readBytes = d->bufferLump(file, buffer);
    }
    else
    {
        // Allocate a temporary buffer and read the whole lump into it(!).
        uint8_t* lumpData = (uint8_t*) M_Malloc(file.size());
        if(!lumpData) throw Error("Zip::readLumpSection", QString("Failed on allocation of %1 bytes for work buffer").arg(file.size()));

        if(d->bufferLump(file, lumpData))
        {
            readBytes = MIN_OF(file.size(), length);
            memcpy(buffer, lumpData + startOffset, readBytes);
        }
        else
        {
            readBytes = 0;
        }
        M_Free(lumpData);
    }

    /// @todo Do not check the read length here.
    if(readBytes < MIN_OF(file.size(), length))
        throw Error("Zip::readLumpSection", QString("Only read %1 of %2 bytes of lump #%3").arg(readBytes).arg(length).arg(lumpIdx));

    return readBytes;
}
开发者ID:roman313,项目名称:Doomsday-Engine,代码行数:57,代码来源:zip.cpp


示例11: memset

SaveInfo *SaveInfo_New(void)
{
    SaveInfo *info = (SaveInfo *)M_Malloc(sizeof *info);

    Str_Init(&info->name);
    info->gameId = 0;
    memset(&info->header, 0, sizeof(info->header));

    return info;
}
开发者ID:roman313,项目名称:Doomsday-Engine,代码行数:10,代码来源:saveinfo.c


示例12: sizeof

// =============================================================================
// 功能:新增SPI总线结点到SPI总线类型结点,并初始化tagSPI_CB控制块结构体
// 参数:NewSPIParam,新增总线参数,参数说明详细请参照tagSPI_Param结构体
// 返回:返回建立的资源结点指针,失败时返回NULL
// =============================================================================
struct tagSPI_CB *SPI_BusAdd(struct tagSPI_Param *NewSPIParam)
{
    struct tagSPI_CB *NewSPI;
    if(NULL == NewSPIParam)
        goto exit_from_param;

    //避免重复建立同名的SPI总线
    if(NULL != Rsc_SearchSon(&s_SPIBusType,NewSPIParam->BusName))
        goto exit_from_readd;

    NewSPI = (struct tagSPI_CB *)M_Malloc(sizeof(struct tagSPI_CB),0);
    if(NewSPI == NULL)
        goto exit_from_malloc;

    //将总线结点挂接到总线类型结点的子结点
    Rsc_AddSon(&s_SPIBusType,&NewSPI->SPI_BusNode,
                sizeof(struct tagSPI_CB),RSC_SPIBUS,NewSPIParam->BusName);
    if(&NewSPI->SPI_BusNode == NULL)
        goto exit_from_add_node;

    //创建总线信号量和阻塞信号量
    NewSPI->SPI_BusSemp= Lock_SempCreate(1,1,CN_SEMP_BLOCK_FIFO,"spi bus semp");
    if(NewSPI->SPI_BusSemp== NULL)
        goto exit_from_spi_bus_semp;
    NewSPI->SPI_BlockSemp = Lock_SempCreate(1,0,CN_SEMP_BLOCK_FIFO,"spi block semp");
    if(NewSPI->SPI_BlockSemp== NULL)
        goto exit_from_spi_buf_semp;

    //tagSPI_CB控制块初始化
    NewSPI->SpecificFlag      = NewSPIParam->SpecificFlag;
    NewSPI->pTransferTxRx     = NewSPIParam->pTransferTxRx;
    NewSPI->pCsActive         = NewSPIParam->pCsActive;
    NewSPI->pCsInActive       = NewSPIParam->pCsInActive;
    NewSPI->pBusCtrl          = NewSPIParam->pBusCtrl;
    NewSPI->pTransferPoll     = NewSPIParam->pTransferPoll;

    //缓冲区初始化
    NewSPI->SPI_Buf.pBuf     = NewSPIParam->SPIBuf;
    NewSPI->SPI_Buf.MaxLen   = NewSPIParam->SPIBufLen;
    NewSPI->SPI_Buf.Offset   = 0;

    printk("%s Added Succeeded!\r\n",NewSPIParam->BusName);
    return NewSPI;

exit_from_spi_buf_semp:
    Lock_SempDelete(NewSPI->SPI_BusSemp);
exit_from_spi_bus_semp:
    Rsc_DelNode(&NewSPI->SPI_BusNode);
exit_from_add_node:
    free(NewSPI);
exit_from_malloc:
exit_from_readd:
exit_from_param:
    return NULL;
}
开发者ID:Mars-Wu,项目名称:djyos,代码行数:60,代码来源:spibus.c


示例13: sizeof

void FTextureManager::AddComplexAnim (FTextureID picnum, const TArray<FAnimDef::FAnimFrame> &frames)
{
	FAnimDef *anim = (FAnimDef *)M_Malloc (sizeof(FAnimDef) + (frames.Size()-1) * sizeof(frames[0]));
	anim->BasePic = picnum;
	anim->NumFrames = frames.Size();
	anim->CurFrame = 0;
	anim->AnimType = FAnimDef::ANIM_DiscreteFrames;
	anim->SwitchTime = 0;
	memcpy (&anim->Frames[0], &frames[0], frames.Size() * sizeof(frames[0]));
	AddAnim (anim);
}
开发者ID:Quaker540,项目名称:gzdoom,代码行数:11,代码来源:animations.cpp


示例14: R_ClearDrawSegs

//
// R_ClearDrawSegs
//
void R_ClearDrawSegs (void)
{
	if (drawsegs == NULL)
	{
		MaxDrawSegs = 256;		// [RH] Default. Increased as needed.
		firstdrawseg = drawsegs = (drawseg_t *)M_Malloc (MaxDrawSegs * sizeof(drawseg_t));
	}
	FirstInterestingDrawseg = 0;
	InterestingDrawsegs.Clear ();
	ds_p = drawsegs;
}
开发者ID:Xeomuz,项目名称:Doom-Port-Source-Code,代码行数:14,代码来源:r_bsp.cpp


示例15: Printf

void FTextureManager::InitSwitchList ()
{
	const BITFIELD texflags = TEXMAN_Overridable | TEXMAN_TryAny;
	int lump = Wads.CheckNumForName ("SWITCHES");

	if (lump != -1)
	{
		FMemLump lumpdata = Wads.ReadLump (lump);
		const char *alphSwitchList = (const char *)lumpdata.GetMem();
		const char *list_p;
		FSwitchDef *def1, *def2;

		for (list_p = alphSwitchList; list_p[18] || list_p[19]; list_p += 20)
		{
			// [RH] Check for switches that aren't really switches
			if (stricmp (list_p, list_p+9) == 0)
			{
				Printf ("Switch %s in SWITCHES has the same 'on' state\n", list_p);
				continue;
			}
			// [RH] Skip this switch if its textures can't be found.
			if (CheckForTexture (list_p /* .name1 */, FTexture::TEX_Wall, texflags).Exists() &&
				CheckForTexture (list_p + 9 /* .name2 */, FTexture::TEX_Wall, texflags).Exists())
			{
				def1 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
				def2 = (FSwitchDef *)M_Malloc (sizeof(FSwitchDef));
				def1->PreTexture = def2->frames[0].Texture = CheckForTexture (list_p /* .name1 */, FTexture::TEX_Wall, texflags);
				def2->PreTexture = def1->frames[0].Texture = CheckForTexture (list_p + 9, FTexture::TEX_Wall, texflags);
				def1->Sound = def2->Sound = 0;
				def1->NumFrames = def2->NumFrames = 1;
				def1->frames[0].TimeMin = def2->frames[0].TimeMin = 0;
				def1->frames[0].TimeRnd = def2->frames[0].TimeRnd = 0;
				AddSwitchPair(def1, def2);
			}
		}
	}

	mSwitchDefs.ShrinkToFit ();
	qsort (&mSwitchDefs[0], mSwitchDefs.Size(), sizeof(FSwitchDef *), SortSwitchDefs);
}
开发者ID:AkumaKing,项目名称:Xeu,代码行数:40,代码来源:anim_switches.cpp


示例16: SPI_BusFind

// =============================================================================
// 功能:在SPI总线结点上增加器件,即总线上挂接的器件,并初始化器件所对应的参数配置寄
//       存器,该器件属于总线结点的子结点
// 参数:BusName,新增子器件挂接的总线名称
//       DevName,器件名称
//       cs,该器件所属的片选序号
//       charlen,器件的字符长度,比特位数
//       mode,配置从器件模式,CHPA和CPOL组合成成的模式
//       freq,SPI总线的时钟频率,单位Hz
//       autocs,新增加设备是否自动片选
// 返回:控制块结点指针,添加失败时返回NULL
// =============================================================================
struct tagSPI_Device *SPI_DevAdd(char *BusName ,char *DevName,u8 cs,u8 charlen,
                                u8 mode,u8 shiftdir,u32 freq,u8 autocs)
{
    struct tagSPI_CB      *SPI;
    struct tagSPI_Device *NewDev;
    tagSpiConfig spicfg;

    //查询是否该总线存在
    SPI = SPI_BusFind(BusName);
    if(NULL == SPI)
        return NULL;

    //避免建立同名的SPI器件
    if(NULL != Rsc_SearchSon(&SPI->SPI_BusNode,DevName))
        return NULL;

    //为新的器件结点动态分配内存
    NewDev = (struct tagSPI_Device *)M_Malloc(sizeof(struct tagSPI_Device),0);
    if(NULL == NewDev)
        return NULL;

    //为新结点初始化
    NewDev->Cs  = cs;
    Rsc_AddSon(&SPI->SPI_BusNode,&NewDev->DevNode,
                sizeof(struct tagSPI_Device),RSC_SPI_DEVICE,DevName);
    if(NULL == &NewDev->DevNode)
    {
        free(NewDev);
        return NULL;
    }

    NewDev->CharLen    = charlen;
    NewDev->Cs         = cs;
    NewDev->AutoCs     = autocs;
    NewDev->Mode       = mode;
    NewDev->Freq       = freq;
    NewDev->ShiftDir   = shiftdir;

    spicfg.CharLen = charlen;
    spicfg.Mode    = mode;
    spicfg.Freq    = freq;
    spicfg.ShiftDir= shiftdir;

    //如果SPI控制器有多套CS寄存器,则配置它,否则不作配置
    if(true == SPI->MultiCsReg)
    {
        SPI_BusCtrl(NewDev,CN_SPI_CS_CONFIG,(ptu32_t)cs,(ptu32_t)&spicfg);
    }

    printk("SPI Device %s Added Succeeded!\r\n",DevName);
    return NewDev;
}
开发者ID:Mars-Wu,项目名称:djyos,代码行数:64,代码来源:spibus.c


示例17: R_3D_AddHeight

void R_3D_AddHeight(secplane_t *add, sector_t *sec)
{
	HeightLevel *near;
	HeightLevel *curr;

	double height = add->ZatPoint(ViewPos);
	if(height >= sec->CenterCeiling()) return;
	if(height <= sec->CenterFloor()) return;

	fakeActive = 1;

	if(height_max >= 0) {
		near = height_top;
		while(near && near->height < height) near = near->next;
		if(near) {
			if(near->height == height) return;
			curr = (HeightLevel*)M_Malloc(sizeof(HeightLevel));
			curr->height = height;
			curr->prev = near->prev;
			curr->next = near;
			if(near->prev) near->prev->next = curr;
			else height_top = curr;
			near->prev = curr;
		} else {
			curr = (HeightLevel*)M_Malloc(sizeof(HeightLevel));
			curr->height = height;
			curr->prev = height_cur;
			curr->next = NULL;
			height_cur->next = curr;
			height_cur = curr;
		}
	} else {
		height_top = height_cur = (HeightLevel*)M_Malloc(sizeof(HeightLevel));
		height_top->height = height;
		height_top->prev = NULL;
		height_top->next = NULL;
	}
	height_max++;
}
开发者ID:dwing4g,项目名称:gzdoom,代码行数:39,代码来源:r_3dfloors.cpp


示例18: Unload

// Fix for certain special patches on single-patch textures.
void FPatchTexture::HackHack (int newheight)
{
	BYTE *out;
	int x;

	Unload ();
	if (Spans != NULL)
	{
		FreeSpans (Spans);
	}

	{
		FMemLump lump = Wads.ReadLump (SourceLump);
		const patch_t *patch = (const patch_t *)lump.GetMem();

		Width = LittleShort(patch->width);
		Height = newheight;
		LeftOffset = 0;
		TopOffset = 0;

		Pixels = new BYTE[Width * Height];

		// Draw the image to the buffer
		for (x = 0, out = Pixels; x < Width; ++x)
		{
			const BYTE *in = (const BYTE *)patch + LittleLong(patch->columnofs[x]) + 3;

			for (int y = newheight; y > 0; --y)
			{
				*out = *in != 255 ? *in : Near255;
				out++, in++;
			}
			out += newheight;
		}
	}

	// Create the spans
	Spans = (Span **)M_Malloc (sizeof(Span *)*Width + sizeof(Span)*Width*2);

	Span *span = (Span *)&Spans[Width];

	for (x = 0; x < Width; ++x)
	{
		Spans[x] = span;
		span[0].Length = newheight;
		span[0].TopOffset = 0;
		span[1].Length = 0;
		span[1].TopOffset = 0;
		span += 2;
	}
}
开发者ID:ddraigcymraeg,项目名称:scoredoomst,代码行数:52,代码来源:patchtexture.cpp


示例19: ModuleInstall_Wdt

// =============================================================================
// 函数功能:看门狗模块的初始化
// 输入参数:
// 输出参数:
// 返回值  :1成功  0失败
// 说明    :创建看门狗硬件对应的软看门狗。注册看门狗异常信息解析器
// =============================================================================
ptu32_t ModuleInstall_Wdt(ptu32_t para)
{
    bool_t  result_bool;
    u16     evttid;

    g_ptWdtPool = M_Malloc(gc_u32CfgWdtLimit * sizeof(tagWdt),0);
    if(g_ptWdtPool == NULL)
        return 0;
    ptWdtPool = Mb_CreatePool(g_ptWdtPool,gc_u32CfgWdtLimit,sizeof(tagWdt),0,0,"wdt pool");
    //init the queue
    ptWdtHead = NULL;
    ptWdtTail = NULL;
    ptWdtHard = NULL;

    //create the msg box for the api to snd msg to the wdt service task
    ptWdtMsgBox = MsgQ_Create(CN_WDTMSG_LIMIT,sizeof(tagWdtMsg),CN_MSGQ_TYPE_FIFO);

    //create the main service
    evttid = Djy_EvttRegist(EN_CORRELATIVE,CN_PRIO_WDT,0,0,Wdt_Service,
                                NULL,0x1000,"wdt service");
    if(evttid == CN_EVTT_ID_INVALID)
        return 0;
    if( Djy_EventPop(evttid,NULL,0,0,0,0) == CN_EVENT_ID_INVALID)
    {
        printk("WDT MODULE:POP SERVICE FAILED!\n\r");
        Djy_EvttUnregist(evttid);
        return 0;
    }

    //create the soft wdt match the hard wdt
    struct tagWdtHalChipInfo hardpara;
    result_bool = WdtHal_GetChipPara(&hardpara);
    if(true == result_bool)//存在硬件看门狗,则创建硬件看门狗
    {
        fnWdtHardFeed = hardpara.wdtchip_feed;
        ptWdtHard = Wdt_Create(hardpara.wdtchip_name,\
                               hardpara.wdtchip_cycle,\
                               __Wdt_HardWdtYipHook,\
                               EN_EXP_DEAL_IGNORE, NULL);
    }
//todo:此处有警告
    extern bool_t Exp_RegisterThrowinfoDecoder(fnExp_ThrowinfoDecoderModule decoder,const char *name);
    if(false ==Exp_RegisterThrowinfoDecoder(__Wdt_WdtExpInfoDecoder,\
                                            CN_WDT_EXPDECODERNAME))
    {
        printk("WDT MODULE: Register Wdt Exp Decoder Failed!\n\r");
    }

    printk("WDT MODULE:Init end ...\n\r");
    return 1;
}
开发者ID:jiankangshiye,项目名称:DJYOS,代码行数:58,代码来源:wdt_soft.c


示例20: sizeof

FName::NameManager::NameBlock *FName::NameManager::AddBlock (size_t len)
{
	NameBlock *block;

	len += sizeof(NameBlock);
	if (len < BLOCK_SIZE)
	{
		len = BLOCK_SIZE;
	}
	block = (NameBlock *)M_Malloc (len);
	block->NextAlloc = sizeof(NameBlock);
	block->NextBlock = Blocks;
	Blocks = block;
	return block;
}
开发者ID:Edward850,项目名称:zdoom,代码行数:15,代码来源:name.cpp



注:本文中的M_Malloc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ M_PREPEND函数代码示例发布时间:2022-05-30
下一篇:
C++ M_GetText函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap