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

C++ MEM_free函数代码示例

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

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



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

示例1: crb_nv_fopen_proc

CRB_Value
crb_nv_fopen_proc(CRB_Interpreter *interpreter,
                  CRB_LocalEnvironment *env,
                  int arg_count, CRB_Value *args)
{
    CRB_Value value;
    char *filename;
    char *mode;
    FILE *fp;

    check_argument_count(arg_count, 2);

    if (args[0].type != CRB_STRING_VALUE
        || args[1].type != CRB_STRING_VALUE) {
        crb_runtime_error(0, FOPEN_ARGUMENT_TYPE_ERR,
                          MESSAGE_ARGUMENT_END);
    }

    filename = CRB_wcstombs_alloc(args[0].u.object->u.string.string);
    mode = CRB_wcstombs_alloc(args[1].u.object->u.string.string);

    fp = fopen(filename, mode);
    if (fp == NULL) {
        value.type = CRB_NULL_VALUE;
    } else {
        value.type = CRB_NATIVE_POINTER_VALUE;
        value.u.native_pointer.info = &st_native_lib_info;
        value.u.native_pointer.pointer = fp;
    }
    MEM_free(filename);
    MEM_free(mode);

    return value;
}
开发者ID:yili3366,项目名称:toy_compiler,代码行数:34,代码来源:native.c


示例2: Ivyc_create_using_list

UsingList *
Ivyc_create_using_list(PackageName *package_name)
{
    UsingList *rl;
    Ivyc_Compiler *compiler;
    char *current_package_name;
    char *req_package_name;

    compiler = Ivyc_get_current_compiler();

    current_package_name = Ivyc_package_name_to_string(compiler->package_name);
    req_package_name = Ivyc_package_name_to_string(package_name);
    if (ISandBox_compare_string(req_package_name, current_package_name)
        && compiler->source_suffix == IVH_SOURCE) {
        Ivyc_compile_error(compiler->current_line_number,
                          USING_ITSELF_ERR, MESSAGE_ARGUMENT_END);
    }
    MEM_free(current_package_name);
    MEM_free(req_package_name);

    rl = Ivyc_malloc(sizeof(UsingList));
    rl->package_name = package_name;
	rl->source_suffix = IVH_SOURCE;
    rl->line_number = Ivyc_get_current_compiler()->current_line_number;
    rl->next = NULL;

    return rl;
}
开发者ID:rod-lin,项目名称:Ivory,代码行数:28,代码来源:create.c


示例3: TC_end

void TC_end()
{
    // initialized ?
    if (uploads != NULL)
    {
        // disabled tile cache Int processing
        VIntProcess &= ~PROCESS_TILECACHE_TASK;

        // release the last uploaded tileset(s)
        if (uploadDone)
        {
            TileSet** tilesets = uploads;
            u16 i = uploadIndex;

            while(i--)
            {
                TileSet* tileset = *tilesets++;

                // released the tileset if we unpacked it here
                if (tileset->compression != COMPRESSION_NONE)
                    MEM_free(tileset);
            }
        }

        // release cache structures memory
        MEM_free(uploads);
        uploads = NULL;
    }
}
开发者ID:kubilus1,项目名称:SGDK,代码行数:29,代码来源:tile_cache.c


示例4: DKC_dispose_compiler

void
DKC_dispose_compiler(DKC_Compiler *compiler)
{
    CompilerList *list = NULL;
    CompilerList *pos;
    FunctionDefinition *fd_pos;
    CompilerList *temp;

    list = traversal_compiler(list, compiler);

    for (pos = list; pos; ) {
        for (fd_pos = pos->compiler->function_list; fd_pos;
             fd_pos = fd_pos->next) {
            MEM_free(fd_pos->local_variable);
        }
        while (pos->compiler->required_list) {
            temp = pos->compiler->required_list;
            pos->compiler->required_list = temp->next;
            MEM_free(temp);
        }
        MEM_dispose_storage(pos->compiler->compile_storage);
        temp = pos->next;
        MEM_free(pos);
        pos = temp;
    }
}
开发者ID:3man,项目名称:devlang,代码行数:26,代码来源:interface.c


示例5: DPI_close

/*
 *  ======== DPI_close ========
 */
Static Int DPI_close(DEV_Handle dev)
{
    PipeObj         *pipe = (PipeObj *)dev->object;
    SPipeObj        *sPipe = pipe->sPipe;

    MEM_free(0, pipe, sizeof(PipeObj));
    
    SEM_pend(mutex, SYS_FOREVER);

    sPipe->device[dev->mode] = NULL;
    sPipe->readySem[dev->mode] = NULL;
             
    if (sPipe->device[DEV_INPUT] == NULL &&
                sPipe->device[DEV_OUTPUT] == NULL) {
        /* delete all shared pipe sub-objects */
        SEM_delete(sPipe->dataSem);
        SEM_delete(sPipe->freeSem);

        /* remove sPipe obj from sPipeList */
        QUE_remove(&sPipe->link);
        
        /* delete sPipe object itself */
        MEM_free(0, sPipe, sizeof (SPipeObj));
    }

    SEM_post(mutex);

    return (SYS_OK);
}
开发者ID:andreimironenko,项目名称:bios,代码行数:32,代码来源:dpi.c


示例6: DOV_close

/*
 *  ======== DOV_close ========
 */
static Int DOV_close(DEV_Handle device)
{
    DOV_CopyObj *copy = (DOV_CopyObj *)device->object;
    DEV_Frame   *frame;

    /* close underlying device(s) */
    DEV_close(&(copy->dobj));

    /* move frames _up_ from downstream device */
    while (!QUE_empty(copy->dobj.todevice)) {
        frame = QUE_get(copy->dobj.todevice);

        frame->size = frame->size + copy->size;
        frame->addr = (Char *)frame->addr - copy->size;

        QUE_put(device->todevice, frame);
    }

    QUE_delete(copy->dobj.todevice);
    QUE_delete(copy->dobj.fromdevice);

    /* free overlap buffer */
    MEM_free(0, copy->overlap, copy->size);

    /* recycle copy object */ 
    MEM_free(0, copy, sizeof(DOV_CopyObj));

    return (SYS_OK);
}
开发者ID:andreimironenko,项目名称:bios,代码行数:32,代码来源:dov.c


示例7: smeMAP_Unload

void smeMAP_Unload(smeMap* map)
{
    MEM_free(map->PlaneB->Tiles);
    map->PlaneB->Tiles = NULL;
    MEM_free(map->PlaneA->Tiles);
    map->PlaneA->Tiles = NULL;
}
开发者ID:skarab,项目名称:megadrive-game,代码行数:7,代码来源:sme_map.c


示例8: array_sweep

/* 配列の再帰的領域解放 : 要素から先にマークを確認し, 開放していく */
static void array_sweep(LL1LL_Object *ary_ptr)
{
  int i;
  LL1LL_Value ary_i;

  /* 配列要素のスイープ */
  for (i = 0; i < ary_ptr->u.ary.size; i++) {
    ary_i = ary_ptr->u.ary.array_value[i];  /* 要素を取得 */
    if (ary_i.type != LL1LL_OBJECT_TYPE) {
      /* オブジェクト型でないなら次へ */
      continue;
    } else {
      /* オブジェクト型の場合 */
      if (ary_i.u.object->marked == LL1LL_FALSE) {
        /* マークがFALSE => スイープ(解放) */
        if (ary_i.u.object->type == STRING_OBJECT) {
          MEM_free(ary_i.u.object); /* 文字列ならばそのまま解放 */
        } else {
          /* should be ARRAY_OBJECT here */
          /* 配列ならば要素のスイープ */
          array_sweep(ary_i.u.object);
        }
      }

    }
  }

  /* 大本の配列のスイープ */
  if (ary_ptr->marked == LL1LL_FALSE) {
    MEM_free(ary_ptr);
  }

}
开发者ID:MrAiki,项目名称:LL1LL,代码行数:34,代码来源:heap.c


示例9: SVM_FreeObject

void SVM_FreeObject(SVMObject *ob) {
  if (ob->fields)
    MEM_free(ob->fields);
  if (ob->names)
    MEM_free(ob->names);
  
  MEM_free(ob);
}
开发者ID:joeedh,项目名称:FunLittleProject,代码行数:8,代码来源:object.c


示例10: DEV_rmframe

/*
 *  ======== DEV_rmframe ========
 */
Void DEV_rmframe(DEV_Frame *frame, Int segid, Uns size)
{
    if (size > 0) {
        /* free buffer */
        MEM_free(segid, frame->addr, size);
    }

    /* free object */
    MEM_free(0, frame, sizeof(DEV_Frame));
}
开发者ID:andreimironenko,项目名称:bios,代码行数:13,代码来源:dev.c


示例11: nv_fgets_proc

static CRB_Value
nv_fgets_proc(CRB_Interpreter *interpreter,
              CRB_LocalEnvironment *env,
              int arg_count, CRB_Value *args)
{
    CRB_Value value;
    FILE *fp;
    char buf[LINE_BUF_SIZE];
    char *mb_buf = NULL;
    int ret_len = 0;
    CRB_Char *wc_str;

    CRB_check_argument_count(interpreter, env, arg_count, 1);

    if (args[0].type != CRB_NATIVE_POINTER_VALUE
        || (!CRB_check_native_pointer_type(args[0].u.object,
                                           &st_file_type_info))) {
        CRB_error(interpreter, env, &st_lib_info, __LINE__,
                  (int)FGETS_ARGUMENT_TYPE_ERR,
                  CRB_MESSAGE_ARGUMENT_END);
    }
    check_file_pointer(interpreter,env, args[0].u.object);
    fp = CRB_object_get_native_pointer(args[0].u.object);

    while (fgets(buf, LINE_BUF_SIZE, fp)) {
        int new_len;
        new_len = ret_len + strlen(buf);
        mb_buf = MEM_realloc(mb_buf, new_len + 1);
        if (ret_len == 0) {
            strcpy(mb_buf, buf);
        } else {
            strcat(mb_buf, buf);
        }
        ret_len = new_len;
        if (mb_buf[ret_len-1] == '\n')
            break;
    }
    if (ret_len > 0) {
        wc_str = CRB_mbstowcs_alloc(interpreter, env, __LINE__, mb_buf);
        if (wc_str == NULL) {
            MEM_free(mb_buf);
            CRB_error(interpreter, env, &st_lib_info, __LINE__,
                      (int)FGETS_BAD_MULTIBYTE_CHARACTER_ERR,
                      CRB_MESSAGE_ARGUMENT_END);
        }
        value.type = CRB_STRING_VALUE;
        value.u.object = CRB_create_crowbar_string(interpreter, env, wc_str);
    } else {
        value.type = CRB_NULL_VALUE;
    }
    MEM_free(mb_buf);

    return value;
}
开发者ID:BluePanM,项目名称:code,代码行数:54,代码来源:native.c


示例12: raster_free

void raster_free(Raster *raster) {
	hashtable_releaseitems(&raster->verts);
	hashtable_releaseitems(&raster->segments);
	hashtable_releaseitems(&raster->paths);
	hashtable_releaseitems(&raster->styles);
	hashtable_releaseitems(&raster->textures);
	hashtable_release(&raster->master);

	MEM_free(raster->buffer);
	MEM_free(raster);
}
开发者ID:joeedh,项目名称:graphics_terminal,代码行数:11,代码来源:raster_types.c


示例13: dispose_local_variable

static void
dispose_local_variable(int local_variable_count,
                       DVM_LocalVariable *local_variable)
{
    int i;

    for (i = 0; i < local_variable_count; i++) {
        MEM_free(local_variable[i].name);
        dispose_type_specifier(local_variable[i].type);
    }
    MEM_free(local_variable);
}
开发者ID:3man,项目名称:devlang,代码行数:12,代码来源:dispose.c


示例14: _remove

static void _remove ( list *list, listNode *node )
{
	if ( list->freeFn )
	{
		list->freeFn ( node->data );
	}

	list->length--;

	MEM_free ( node->data );
	MEM_free ( node );
}
开发者ID:moon-watcher,项目名称:GrielsQuest,代码行数:12,代码来源:list.c


示例15: MEM_free

void 		bfqDelete			( BufferQueue_Handle queue )
{
	Int i;
	
	// only have to free the buffers.
	for (i=0; i<queue->BufCount; i++)
		MEM_free( queue->SegId, queue->Frames[i].Buffer, queue->BufSize );
		
	// de-allocate the frames if they were allocate within the queue
	if (queue->bDynamicFrames)
		MEM_free( 0, queue->Frames, sizeof(BufferQueue_Frame) * queue->BufCount );
}
开发者ID:scs,项目名称:leanxsugus,代码行数:12,代码来源:libBufferQueue.c


示例16: dispose_enum

static void
dispose_enum(DVM_Enum *enum_type)
{
    int i;

    MEM_free(enum_type->package_name);
    MEM_free(enum_type->name);

    for (i = 0; i < enum_type->enumerator_count; i++) {
        MEM_free(enum_type->enumerator[i]);
    }
    if (enum_type->is_defined) {
        MEM_free(enum_type->enumerator);
    }
}
开发者ID:3man,项目名称:devlang,代码行数:15,代码来源:dispose.c


示例17: call_native_function

static CRB_Value
call_native_function(CRB_Interpreter *inter, LocalEnviroment *env,
        Exprssion *expr, CRB_NativeFunctionProc *proc)
{
    CRB_Value value;
    int arg_count;
    ArgumentList *arg_p;
    CRB_Value *args;
    int i;

    for(arg_count = 0, arg_p = expr->u.function_call_expression.argument;
            arg_p;arg_p = arg_p->next){
        arg_count++;
    }

    arg = MEM_malloc(sizeof(CRB_Value) * arg_count);

    for(arg_p = expr->u.function_call_expression.argument, i = 0;
            arg_p; arg_p = arg_p->next, i++){
        args[i] = eval_expression(inter, env, arg_p->next);
    }
    val = proc(inter, arg_count, args);
    for( i = 0;i < arg_count;i++){
        release_if_string(&args[i]);
    }
    MEM_free(args);

    return value;
}
开发者ID:Chainhelen,项目名称:program_language,代码行数:29,代码来源:eval.c


示例18: NdpAddDataToNeighborCache

//-------------------------------------------------------------------------
// FUNCTION     : NdpAddDataToNeighborCache()
//
// PURPOSE      : Adding data to neighbor cache
//
// PARAMETERS   : neighborCache - pointer to neighbor cache
//                neighborData - neighbor data to be added
//
// RETURN VALUE : None
//-------------------------------------------------------------------------
static
void NdpAddDataToNeighborCache(
    NdpNeighborTable* neighborCache,
    NdpNeighborStruct* neighborData)
{
    if (neighborCache && neighborData)
    {
        if (neighborCache->numEntry == neighborCache->maxEntry)
        {
            unsigned int newNeighborCacheSize = (unsigned int)
                ((neighborCache->numEntry + NDP_INITIAL_CACHE_ENTRY)
                    * sizeof(NdpNeighborStruct));

            NdpNeighborStruct* tempCache = (NdpNeighborStruct*)
                MEM_malloc(newNeighborCacheSize);
            memset(tempCache, 0, newNeighborCacheSize);

            memcpy(tempCache, neighborCache->neighborTable,
                (sizeof(NdpNeighborStruct) * neighborCache->numEntry));

            MEM_free(neighborCache->neighborTable);

            neighborCache->neighborTable = tempCache;

            neighborCache->maxEntry = neighborCache->numEntry
                                      + NDP_INITIAL_CACHE_ENTRY;
        }
        memcpy(&(neighborCache->neighborTable[neighborCache->numEntry]),
            neighborData, sizeof(NdpNeighborStruct));

        neighborCache->numEntry++;
    }// end if (neighborCache && neighborData)
}
开发者ID:LXiong,项目名称:ccn,代码行数:43,代码来源:network_ipv4_ndp.cpp


示例19: add_default_package

static UsingList *
add_default_package(UsingList *using_list)
{
    UsingList *req_pos;
    ISandBox_Boolean default_package_usingd = ISandBox_FALSE;

    for (req_pos = using_list; req_pos; req_pos = req_pos->next) {
        char *temp_name
            = Ivyc_package_name_to_string(req_pos->package_name);
        if (!strcmp(temp_name, ISandBox_Ivory_DEFAULT_PACKAGE)) {
            default_package_usingd = ISandBox_TRUE;
        }
        MEM_free(temp_name);
    }

    if (!default_package_usingd) {
        PackageName *pn;
        UsingList *req_temp;

        pn = Ivyc_create_package_name(ISandBox_Ivory_DEFAULT_PACKAGE_P1);
        pn = Ivyc_chain_package_name(pn, ISandBox_Ivory_DEFAULT_PACKAGE_P2);
        req_temp = using_list;
        using_list = Ivyc_create_using_list(pn);
        using_list->next = req_temp;
    }
    return using_list;
}
开发者ID:rod-lin,项目名称:Ivory,代码行数:27,代码来源:create.c


示例20: addToUploadQueue

static void addToUploadQueue(TileSet *tileset, u16 index)
{
    // need to clear to queue ?
    if (uploadDone)
    {
        TileSet** tilesets = uploads;
        u16 i = uploadIndex;

        while(i--)
        {
            TileSet* ts = *tilesets++;

            // released the tileset if we unpacked it here
            if (ts->compression != COMPRESSION_NONE)
                MEM_free(ts);
        }

        // prepare for new upload
        uploadDone = FALSE;
        uploadIndex = 0;
    }

    // set upload tileset info
    uploads[uploadIndex++] = tileset;

    // put in DMA queue
    DMA_queueDma(DMA_VRAM, (u32) tileset->tiles, index * 32, tileset->numTile * 16, 2);
}
开发者ID:kubilus1,项目名称:SGDK,代码行数:28,代码来源:tile_cache.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ MEM_freeN函数代码示例发布时间:2022-05-30
下一篇:
C++ MEM_dupallocN函数代码示例发布时间: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