vbscript: Rename vbsheap to heap_pool.

This commit is contained in:
Piotr Caban 2013-02-15 15:11:13 +01:00 committed by Alexandre Julliard
parent 7246f7f3aa
commit fb29bf7d2f
7 changed files with 26 additions and 26 deletions

View File

@ -118,14 +118,14 @@ static void dump_code(compile_ctx_t *ctx)
static inline void *compiler_alloc(vbscode_t *vbscode, size_t size) static inline void *compiler_alloc(vbscode_t *vbscode, size_t size)
{ {
return vbsheap_alloc(&vbscode->heap, size); return heap_pool_alloc(&vbscode->heap, size);
} }
static inline void *compiler_alloc_zero(vbscode_t *vbscode, size_t size) static inline void *compiler_alloc_zero(vbscode_t *vbscode, size_t size)
{ {
void *ret; void *ret;
ret = vbsheap_alloc(&vbscode->heap, size); ret = heap_pool_alloc(&vbscode->heap, size);
if(ret) if(ret)
memset(ret, 0, size); memset(ret, 0, size);
return ret; return ret;
@ -1585,7 +1585,7 @@ void release_vbscode(vbscode_t *code)
for(i=0; i < code->bstr_cnt; i++) for(i=0; i < code->bstr_cnt; i++)
SysFreeString(code->bstr_pool[i]); SysFreeString(code->bstr_pool[i]);
vbsheap_free(&code->heap); heap_pool_free(&code->heap);
heap_free(code->bstr_pool); heap_free(code->bstr_pool);
heap_free(code->source); heap_free(code->source);
@ -1615,7 +1615,7 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source)
ctx->instr_cnt = 1; ctx->instr_cnt = 1;
ctx->instr_size = 32; ctx->instr_size = 32;
vbsheap_init(&ret->heap); heap_pool_init(&ret->heap);
ret->option_explicit = ctx->parser.option_explicit; ret->option_explicit = ctx->parser.option_explicit;

View File

@ -37,7 +37,7 @@ typedef struct {
VARIANT *vars; VARIANT *vars;
dynamic_var_t *dynamic_vars; dynamic_var_t *dynamic_vars;
vbsheap_t heap; heap_pool_t heap;
BOOL resume_next; BOOL resume_next;
@ -210,19 +210,19 @@ static HRESULT add_dynamic_var(exec_ctx_t *ctx, const WCHAR *name,
BOOL is_const, VARIANT *val, BOOL own_val, VARIANT **out_var) BOOL is_const, VARIANT *val, BOOL own_val, VARIANT **out_var)
{ {
dynamic_var_t *new_var; dynamic_var_t *new_var;
vbsheap_t *heap; heap_pool_t *heap;
WCHAR *str; WCHAR *str;
unsigned size; unsigned size;
HRESULT hres; HRESULT hres;
heap = ctx->func->type == FUNC_GLOBAL ? &ctx->script->heap : &ctx->heap; heap = ctx->func->type == FUNC_GLOBAL ? &ctx->script->heap : &ctx->heap;
new_var = vbsheap_alloc(heap, sizeof(*new_var)); new_var = heap_pool_alloc(heap, sizeof(*new_var));
if(!new_var) if(!new_var)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
size = (strlenW(name)+1)*sizeof(WCHAR); size = (strlenW(name)+1)*sizeof(WCHAR);
str = vbsheap_alloc(heap, size); str = heap_pool_alloc(heap, size);
if(!str) if(!str)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(str, name, size); memcpy(str, name, size);
@ -1833,7 +1833,7 @@ static void release_exec(exec_ctx_t *ctx)
VariantClear(ctx->vars+i); VariantClear(ctx->vars+i);
} }
vbsheap_free(&ctx->heap); heap_pool_free(&ctx->heap);
heap_free(ctx->args); heap_free(ctx->args);
heap_free(ctx->vars); heap_free(ctx->vars);
heap_free(ctx->stack); heap_free(ctx->stack);
@ -1852,7 +1852,7 @@ HRESULT exec_script(script_ctx_t *ctx, function_t *func, IDispatch *this_obj, DI
return E_FAIL; return E_FAIL;
} }
vbsheap_init(&exec.heap); heap_pool_init(&exec.heap);
if(func->arg_cnt) { if(func->arg_cnt) {
VARIANT *v; VARIANT *v;

View File

@ -263,7 +263,7 @@ typedef struct {
statement_t *stats_tail; statement_t *stats_tail;
class_decl_t *class_decls; class_decl_t *class_decls;
vbsheap_t heap; heap_pool_t heap;
} parser_ctx_t; } parser_ctx_t;
HRESULT parse_script(parser_ctx_t*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN; HRESULT parse_script(parser_ctx_t*,const WCHAR*,const WCHAR*) DECLSPEC_HIDDEN;

View File

@ -922,7 +922,7 @@ void *parser_alloc(parser_ctx_t *ctx, size_t size)
{ {
void *ret; void *ret;
ret = vbsheap_alloc(&ctx->heap, size); ret = heap_pool_alloc(&ctx->heap, size);
if(!ret) if(!ret)
ctx->hres = E_OUTOFMEMORY; ctx->hres = E_OUTOFMEMORY;
return ret; return ret;
@ -935,7 +935,7 @@ HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
ctx->code = ctx->ptr = code; ctx->code = ctx->ptr = code;
ctx->end = ctx->code + strlenW(ctx->code); ctx->end = ctx->code + strlenW(ctx->code);
vbsheap_init(&ctx->heap); heap_pool_init(&ctx->heap);
ctx->parse_complete = FALSE; ctx->parse_complete = FALSE;
ctx->hres = S_OK; ctx->hres = S_OK;
@ -961,5 +961,5 @@ HRESULT parse_script(parser_ctx_t *ctx, const WCHAR *code, const WCHAR *delimite
void parser_release(parser_ctx_t *ctx) void parser_release(parser_ctx_t *ctx)
{ {
vbsheap_free(&ctx->heap); heap_pool_free(&ctx->heap);
} }

View File

@ -172,8 +172,8 @@ static void release_script(script_ctx_t *ctx)
IDispatchEx_Release(&script_obj->IDispatchEx_iface); IDispatchEx_Release(&script_obj->IDispatchEx_iface);
} }
vbsheap_free(&ctx->heap); heap_pool_free(&ctx->heap);
vbsheap_init(&ctx->heap); heap_pool_init(&ctx->heap);
} }
static void destroy_script(script_ctx_t *ctx) static void destroy_script(script_ctx_t *ctx)
@ -568,7 +568,7 @@ static HRESULT WINAPI VBScriptParse_InitNew(IActiveScriptParse *iface)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
ctx->safeopt = This->safeopt; ctx->safeopt = This->safeopt;
vbsheap_init(&ctx->heap); heap_pool_init(&ctx->heap);
list_init(&ctx->objects); list_init(&ctx->objects);
list_init(&ctx->code_list); list_init(&ctx->code_list);
list_init(&ctx->named_items); list_init(&ctx->named_items);

View File

@ -37,11 +37,11 @@ typedef struct {
DWORD last_block; DWORD last_block;
DWORD offset; DWORD offset;
struct list custom_blocks; struct list custom_blocks;
} vbsheap_t; } heap_pool_t;
void vbsheap_init(vbsheap_t*) DECLSPEC_HIDDEN; void heap_pool_init(heap_pool_t*) DECLSPEC_HIDDEN;
void *vbsheap_alloc(vbsheap_t*,size_t) __WINE_ALLOC_SIZE(2) DECLSPEC_HIDDEN; void *heap_pool_alloc(heap_pool_t*,size_t) __WINE_ALLOC_SIZE(2) DECLSPEC_HIDDEN;
void vbsheap_free(vbsheap_t*) DECLSPEC_HIDDEN; void heap_pool_free(heap_pool_t*) DECLSPEC_HIDDEN;
typedef struct _function_t function_t; typedef struct _function_t function_t;
typedef struct _vbscode_t vbscode_t; typedef struct _vbscode_t vbscode_t;
@ -177,7 +177,7 @@ struct _script_ctx_t {
class_desc_t *classes; class_desc_t *classes;
class_desc_t *procs; class_desc_t *procs;
vbsheap_t heap; heap_pool_t heap;
struct list objects; struct list objects;
struct list code_list; struct list code_list;
@ -320,7 +320,7 @@ struct _vbscode_t {
BSTR *bstr_pool; BSTR *bstr_pool;
unsigned bstr_pool_size; unsigned bstr_pool_size;
unsigned bstr_cnt; unsigned bstr_cnt;
vbsheap_t heap; heap_pool_t heap;
struct list entry; struct list entry;
}; };

View File

@ -133,13 +133,13 @@ static inline DWORD block_size(DWORD block)
return MIN_BLOCK_SIZE << block; return MIN_BLOCK_SIZE << block;
} }
void vbsheap_init(vbsheap_t *heap) void heap_pool_init(heap_pool_t *heap)
{ {
memset(heap, 0, sizeof(*heap)); memset(heap, 0, sizeof(*heap));
list_init(&heap->custom_blocks); list_init(&heap->custom_blocks);
} }
void *vbsheap_alloc(vbsheap_t *heap, size_t size) void *heap_pool_alloc(heap_pool_t *heap, size_t size)
{ {
struct list *list; struct list *list;
void *tmp; void *tmp;
@ -194,7 +194,7 @@ void *vbsheap_alloc(vbsheap_t *heap, size_t size)
return list+1; return list+1;
} }
void vbsheap_free(vbsheap_t *heap) void heap_pool_free(heap_pool_t *heap)
{ {
struct list *iter; struct list *iter;
DWORD i; DWORD i;