Repository: neovim/neovim
File: src/nvim/eval/userfunc.c (C)

Code before:
    msg_puts("\n");  // don't overwrite this either

    verbose_leave_scroll();
    no_wait_return--;
  }

  did_emsg |= save_did_emsg;
  depth--;
  for (int i = 0; i < tv_to_free_len; i++) {
    tv_clear(tv_to_free[i]);
  }
  cleanup_function_call(fc);

  if (--fp->uf_calls <= 0 && fp->uf_refcount <= 0) {
    // Function was unreferenced while being used, free it now.
    func_clear_free(fp, false);
  }
  // restore search patterns and redo buffer
  if (did_save_redo) {
    restoreRedobuff(&save_redo);
  }
  restore_search_patterns();
}

/// There are two kinds of function names:
/// 1. ordinary names, function defined with :function
///    can start with "<SNR>123_" literally or with K_SPECIAL.
/// 2. Numbered functions and lambdas: "<lambda>123"
/// For the first we only count the name stored in func_hashtab as a reference,
/// using function() does not count as a reference, because the function is
/// looked up by name.
static bool func_name_refcount(const char *name)
  FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE
{
  return isdigit((uint8_t)(*name)) || (name[0] == '<' && name[1] == 'l');
}

/// Check the argument count for user function "fp".
/// @return  FCERR_UNKNOWN if OK, FCERR_TOOFEW or FCERR_TOOMANY otherwise.
static int check_user_func_argcount(ufunc_T *fp, int argcount)
  FUNC_ATTR_NONNULL_ALL
{
  const int regular_args = fp->uf_args.ga_len;

  if (argcount < regular_args - fp->uf_def_args.ga_len) {
    return FCERR_TOOFEW;
  } else if (!fp->uf_varargs && argcount > regular_args) {
    return FCERR_TOOMANY;
  }
  return FCERR_UNKNOWN;
}

Review comment (suggestion):
```suggestion
/// 1. ordinary names, function defined with :function;
```

Code after:
    msg_puts("\n");  // don't overwrite this either

    verbose_leave_scroll();
    no_wait_return--;
  }

  did_emsg |= save_did_emsg;
  depth--;
  for (int i = 0; i < tv_to_free_len; i++) {
    tv_clear(tv_to_free[i]);
  }
  cleanup_function_call(fc);

  if (--fp->uf_calls <= 0 && fp->uf_refcount <= 0) {
    // Function was unreferenced while being used, free it now.
    func_clear_free(fp, false);
  }
  // restore search patterns and redo buffer
  if (did_save_redo) {
    restoreRedobuff(&save_redo);
  }
  restore_search_patterns();
}

/// There are two kinds of function names:
/// 1. ordinary names, function defined with :function;
///    can start with "<SNR>123_" literally or with K_SPECIAL.
/// 2. Numbered functions and lambdas: "<lambda>123"
/// For the first we only count the name stored in func_hashtab as a reference,
/// using function() does not count as a reference, because the function is
/// looked up by name.
static bool func_name_refcount(const char *name)
  FUNC_ATTR_NONNULL_ALL FUNC_ATTR_PURE
{
  return isdigit((uint8_t)(*name)) || (name[0] == '<' && name[1] == 'l');
}

/// Check the argument count for user function "fp".
/// @return  FCERR_UNKNOWN if OK, FCERR_TOOFEW or FCERR_TOOMANY otherwise.
static int check_user_func_argcount(ufunc_T *fp, int argcount)
  FUNC_ATTR_NONNULL_ALL
{
  const int regular_args = fp->uf_args.ga_len;

  if (argcount < regular_args - fp->uf_def_args.ga_len) {
    return FCERR_TOOFEW;
  } else if (!fp->uf_varargs && argcount > regular_args) {
    return FCERR_TOOMANY;
  }
  return FCERR_UNKNOWN;
}