refactor: object_to_vim() cannot fail

Since the parent commit, object_to_vim() can't fail, so callers don't
need to check its result.
This commit is contained in:
Justin M. Keyes
2023-12-07 13:01:42 +01:00
parent cca6c4c698
commit a16218d4c6
7 changed files with 15 additions and 46 deletions

View File

@@ -207,9 +207,7 @@ static Object _call_function(String fn, Array args, dict_T *self, Error *err)
typval_T vim_args[MAX_FUNC_ARGS + 1];
size_t i = 0; // also used for freeing the variables
for (; i < args.size; i++) {
if (!object_to_vim(args.items[i], &vim_args[i], err)) {
goto free_vim_args;
}
object_to_vim(args.items[i], &vim_args[i], err);
}
// Initialize `force_abort` and `suppress_errthrow` at the top level.
@@ -243,7 +241,6 @@ static Object _call_function(String fn, Array args, dict_T *self, Error *err)
tv_clear(&rettv);
recursive--;
free_vim_args:
while (i > 0) {
tv_clear(&vim_args[--i]);
}
@@ -297,9 +294,7 @@ Object nvim_call_dict_function(Object dict, String fn, Array args, Error *err)
mustfree = true;
break;
case kObjectTypeDictionary:
if (!object_to_vim(dict, &rettv, err)) {
goto end;
}
object_to_vim(dict, &rettv, err);
break;
default:
api_set_error(err, kErrorTypeValidation,