当前位置: 首页>>代码示例>>C++>>正文


C++ MEM_free函数代码示例

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


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


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