[PATCH v3 1/9] vbscript: Use arrays for global variable and function lists.

Jacek Caban jacek at codeweavers.com
Mon Nov 4 10:42:00 CST 2019


Hi Gabriel,

On 11/1/19 4:00 PM, Gabriel Ivăncescu wrote:
> Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
> ---
>
> Supersedes 172426 to 172433.
>
> DISPID_FUNCTION_MASK has been chosen to be the same bit used in TypeLibs
> to separate functions from variables in MEMBERIDs.
>
>   dlls/vbscript/compile.c  |  31 +++++-----
>   dlls/vbscript/interp.c   |  56 ++++++++++++-----
>   dlls/vbscript/vbdisp.c   | 127 ++++++++++++---------------------------
>   dlls/vbscript/vbscript.c |  10 ++-
>   dlls/vbscript/vbscript.h |  52 +++++++++++++---
>   5 files changed, 149 insertions(+), 127 deletions(-)


This could really use a split to at least three patches: one for 
variables, one for functions and one to get rid of ident_map_t. I needed 
to touch functions for the project I'm working on, so I submitted 
functions part based on your patch already.


> +static inline BOOL add_global_var(script_ctx_t *obj, dynamic_var_t *var)
> +{
> +    dynamic_var_t **vars;
> +
> +    if (is_power_of_2(obj->global_vars_num))
> +    {
> +        UINT num = max(16, obj->global_vars_num * 2);
> +
> +        vars = heap_realloc(obj->global_vars, num * sizeof(*obj->global_vars));
> +        if (!vars) return FALSE;
> +        obj->global_vars = vars;
> +    }
> +    obj->global_vars[obj->global_vars_num++] = var;
> +
> +    return TRUE;
> +}
> +
> +static inline BOOL add_global_func(script_ctx_t *obj, function_t *func)
> +{
> +    function_t **funcs;
> +
> +    if (is_power_of_2(obj->global_funcs_num))
> +    {
> +        UINT num = max(16, obj->global_funcs_num * 2);
> +
> +        funcs = heap_realloc(obj->global_funcs, num * sizeof(*obj->global_funcs));
> +        if (!funcs) return FALSE;
> +        obj->global_funcs = funcs;
> +    }
> +    obj->global_funcs[obj->global_funcs_num++] = func;
> +
> +    return TRUE;
> +}
> +


I'd rather not use inline functions for those.


Thanks,

Jacek




More information about the wine-devel mailing list