isn_T *isn;
RETURN_NULL_IF_SKIP(cctx);
- if (ga_grow(instr, 1) == FAIL)
+ if (GA_GROW_FAILS(instr, 1))
return NULL;
isn = ((isn_T *)instr->ga_data) + instr->ga_len;
isn->isn_type = isn_type;
if ((isn = generate_instr(cctx, isn_type)) == NULL)
return NULL;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return NULL;
((type_T **)stack->ga_data)[stack->ga_len] = type == NULL ? &t_any : type;
++stack->ga_len;
isn->isn_arg.getitem.gi_with_op = with_op;
// add the item type to the type stack
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = item_type;
++stack->ga_len;
stack->ga_len -= count;
// add the list type to the type stack
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = type;
++stack->ga_len;
stack->ga_len -= 2 * count;
// add the dict type to the type stack
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = type;
++stack->ga_len;
if (ufunc->uf_flags & FC_CLOSURE)
cctx->ctx_ufunc->uf_flags |= FC_CLOSURE;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] =
ufunc->uf_func_type == NULL ? &t_func_any : ufunc->uf_func_type;
return FAIL;
isn->isn_arg.forloop.for_idx = loop_idx;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
// type doesn't matter, will be stored next
((type_T **)stack->ga_data)[stack->ga_len] = &t_any;
// Drop the argument types and push the return type.
stack->ga_len -= argcount;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] =
internal_func_ret_type(func_idx, argcount, argtypes);
}
stack->ga_len -= argcount; // drop the arguments
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
// add return value
((type_T **)stack->ga_data)[stack->ga_len] = ufunc->uf_ret_type;
isn->isn_arg.ufunc.cuf_argcount = argcount;
stack->ga_len -= argcount; // drop the arguments
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
// add return value
((type_T **)stack->ga_data)[stack->ga_len] = &t_any;
return FAIL;
isn->isn_arg.string = vim_strsave(line);
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = &t_any;
++stack->ga_len;
return FAIL;
isn->isn_arg.string = range;
- if (ga_grow(stack, 1) == FAIL)
+ if (GA_GROW_FAILS(stack, 1))
return FAIL;
((type_T **)stack->ga_data)[stack->ga_len] = &t_number;
++stack->ga_len;
return NULL;
}
- if (ga_grow(&cctx->ctx_locals, 1) == FAIL)
+ if (GA_GROW_FAILS(&cctx->ctx_locals, 1))
return NULL;
lvar = ((lvar_T *)cctx->ctx_locals.ga_data) + cctx->ctx_locals.ga_len++;
CLEAR_POINTER(lvar);
lvar->lv_type = type;
// Remember the name for debugging.
- if (ga_grow(&dfunc->df_var_names, 1) == FAIL)
+ if (GA_GROW_FAILS(&dfunc->df_var_names, 1))
return NULL;
((char_u **)dfunc->df_var_names.ga_data)[lvar->lv_idx] =
vim_strsave(lvar->lv_name);
trailing_error = *s != NUL;
if (expr_res == FAIL || trailing_error
- || ga_grow(&cctx->ctx_instr, 1) == FAIL)
+ || GA_GROW_FAILS(&cctx->ctx_instr, 1))
{
if (trailing_error)
semsg(_(e_trailing_arg), s);
else
{
// variables are always initialized
- if (ga_grow(instr, 1) == FAIL)
+ if (GA_GROW_FAILS(instr, 1))
goto theend;
switch (lhs.lhs_member_type->tt_type)
{
// Move any CMDMOD instruction to after the jump
if (((isn_T *)instr->ga_data)[instr->ga_len - 1].isn_type == ISN_CMDMOD)
{
- if (ga_grow(instr, 1) == FAIL)
+ if (GA_GROW_FAILS(instr, 1))
return NULL;
((isn_T *)instr->ga_data)[instr->ga_len] =
((isn_T *)instr->ga_data)[instr->ga_len - 1];
arg = skipwhite(arg + 1); // skip white after '['
// the list item is replaced by a number of items
- if (ga_grow(stack, var_count - 1) == FAIL)
+ if (GA_GROW_FAILS(stack, var_count - 1))
{
drop_scope(cctx);
return NULL;
trailing_error = *cmd != delimiter && *cmd != NUL;
if (expr_res == FAIL || trailing_error
- || ga_grow(&cctx->ctx_instr, 1) == FAIL)
+ || GA_GROW_FAILS(&cctx->ctx_instr, 1))
{
if (trailing_error)
semsg(_(e_trailing_arg), cmd);
{
// The first position is not used, so that a zero uf_dfunc_idx means it
// wasn't set.
- if (ga_grow(&def_functions, 1) == FAIL)
+ if (GA_GROW_FAILS(&def_functions, 1))
return FAIL;
++def_functions.ga_len;
}
// Add the function to "def_functions".
- if (ga_grow(&def_functions, 1) == FAIL)
+ if (GA_GROW_FAILS(&def_functions, 1))
return FAIL;
dfunc = ((dfunc_T *)def_functions.ga_data) + def_functions.ga_len;
CLEAR_POINTER(dfunc);
if (count > 0)
ectx->ec_stack.ga_len -= count - 1;
- else if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ else if (GA_GROW_FAILS(&ectx->ec_stack, 1))
return FAIL;
else
++ectx->ec_stack.ga_len;
#ifdef FEAT_PROFILE
if (do_profiling == PROF_YES)
{
- if (likely(ga_grow(&profile_info_ga, 1) == OK))
+ if (GA_GROW_OK(&profile_info_ga, 1))
{
profinfo_T *info = ((profinfo_T *)profile_info_ga.ga_data)
+ profile_info_ga.ga_len;
// - if needed: a counter for number of closures created in
// ectx->ec_funcrefs.
varcount = dfunc->df_varcount + dfunc->df_has_closure;
- if (unlikely(ga_grow(&ectx->ec_stack, arg_to_add + STACK_FRAME_SIZE
- + varcount) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, arg_to_add + STACK_FRAME_SIZE + varcount))
return FAIL;
// If depth of calling is getting too high, don't execute the function.
// Result replaces the arguments on the stack.
if (argcount > 0)
ectx->ec_stack.ga_len -= argcount - 1;
- else if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ else if (GA_GROW_FAILS(&ectx->ec_stack, 1))
return FAIL;
else
++ectx->ec_stack.ga_len;
{
// Make space for arguments from the partial, shift the "argcount"
// arguments up.
- if (unlikely(ga_grow(&ectx->ec_stack, pt->pt_argc) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, pt->pt_argc))
return FAIL;
for (i = 1; i <= argcount; ++i)
*STACK_TV_BOT(-i + pt->pt_argc) = *STACK_TV_BOT(-i);
// If this function returns and the closure is still being used, we
// need to make a copy of the context (arguments and local variables).
// Store a reference to the partial so we can handle that.
- if (unlikely(ga_grow(&ectx->ec_funcrefs, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_funcrefs, 1))
{
vim_free(pt);
return FAIL;
p = skipwhite(p);
if (*p == '#')
break;
- if (likely(ga_grow(&ga, 1) == OK))
+ if (GA_GROW_OK(&ga, 1))
((char_u **)(ga.ga_data))[ga.ga_len++] = p;
if (STRNCMP(p, "def ", 4) == 0)
break;
{
// Not inside try or need to return from current functions.
// Push a dummy return value.
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->v_type = VAR_NUMBER;
int res;
int save_flags = cmdmod.cmod_flags;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
init_tv(tv);
// push typeval VAR_INSTR with instructions to be executed
case ISN_INSTR:
{
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->vval.v_instr = ALLOC_ONE(instr_T);
clear_redir_lval();
redir_vname = 0;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
{
vim_free(res);
goto theend;
p = tv_stringify(tv, buf);
len = (int)STRLEN(p);
- if (unlikely(ga_grow(&ga, len + 2) == FAIL))
+ if (GA_GROW_FAILS(&ga, len + 2))
failed = TRUE;
else
{
// load local variable or argument
case ISN_LOAD:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(STACK_TV_VAR(iptr->isn_arg.number), STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
// load v: variable
case ISN_LOADV:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(get_vim_var_tv(iptr->isn_arg.number), STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
if (sv == NULL)
goto theend;
allocate_if_null(sv->sv_tv);
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(sv->sv_tv, STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
}
else
{
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(&di->di_tv, STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
}
else
{
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(&di->di_tv, STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
{
char_u *name = iptr->isn_arg.string;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
SOURCING_LNUM = iptr->isn_lnum;
if (eval_variable(name, (int)STRLEN(name),
default: // Cannot reach here
goto theend;
}
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->v_type = VAR_DICT;
// This is not expected to fail, name is checked during
// compilation: don't set SOURCING_LNUM.
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
if (eval_option(&name, &optval, TRUE) == FAIL)
goto theend;
typval_T optval;
char_u *name = iptr->isn_arg.string;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
// name is always valid, checked when compiling
(void)eval_env_var(&name, &optval, TRUE);
// load @register
case ISN_LOADREG:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->v_type = VAR_STRING;
+ iptr->isn_arg.outer.outer_idx;
if (iptr->isn_type == ISN_LOADOUTER)
{
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
copy_tv(tv, STACK_TV_BOT(0));
++ectx->ec_stack.ga_len;
case ISN_PUSHFUNC:
case ISN_PUSHCHANNEL:
case ISN_PUSHJOB:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
tv->v_lock = 0;
if (count > 0)
ectx->ec_stack.ga_len -= 2 * count - 1;
- else if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ else if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
else
++ectx->ec_stack.ga_len;
// return from a :def function call without a value
case ISN_RETURN_VOID:
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
++ectx->ec_stack.ga_len;
if (pt == NULL)
goto theend;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
{
vim_free(pt);
goto theend;
typval_T *idxtv =
STACK_TV_VAR(iptr->isn_arg.forloop.for_idx);
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
if (ltv->v_type == VAR_LIST)
{
{
trycmd_T *trycmd = NULL;
- if (unlikely(GA_GROW(&ectx->ec_trystack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_trystack, 1))
goto theend;
trycmd = ((trycmd_T *)ectx->ec_trystack.ga_data)
+ ectx->ec_trystack.ga_len;
iemsg("Evaluating catch while current_exception is NULL");
goto theend;
}
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
tv = STACK_TV_BOT(0);
++ectx->ec_stack.ga_len;
tv = STACK_TV_BOT(-1 - gi->gi_with_op);
li = list_find(tv->vval.v_list, gi->gi_index);
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
++ectx->ec_stack.ga_len;
copy_tv(&li->li_tv, STACK_TV_BOT(-1));
if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL)
goto on_error;
- if (unlikely(GA_GROW(&ectx->ec_stack, 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, 1))
goto theend;
++ectx->ec_stack.ga_len;
tv = STACK_TV_BOT(-1);
}
CHECK_LIST_MATERIALIZE(l);
- if (unlikely(GA_GROW(&ectx->ec_stack, count - 1) == FAIL))
+ if (GA_GROW_FAILS(&ectx->ec_stack, count - 1))
goto theend;
ectx->ec_stack.ga_len += count - 1;
CLEAR_FIELD(ectx);
ectx.ec_dfunc_idx = ufunc->uf_dfunc_idx;
ga_init2(&ectx.ec_stack, sizeof(typval_T), 500);
- if (unlikely(ga_grow(&ectx.ec_stack, 20) == FAIL))
+ if (GA_GROW_FAILS(&ectx.ec_stack, 20))
{
funcdepth_decrement();
return FAIL;