refactor(options): remove set_string_option_direct()

Problem: `set_string_option_direct()` contains a separate codepath specifically for setting string options. Not only is that unnecessary code duplication, but it's also limited to only string options.

Solution: Replace `set_string_option_direct()` with `set_option_direct()` which calls `set_option()` under the hood. This reduces code duplication and allows directly setting an option of any type.
This commit is contained in:
Famiu Haque
2024-02-03 12:57:03 +06:00
parent 5aa8c02a9d
commit 2214f9c19d
15 changed files with 93 additions and 135 deletions

View File

@@ -5154,7 +5154,7 @@ void ex_cfile(exarg_T *eap)
}
}
if (*eap->arg != NUL) {
set_string_option_direct(kOptErrorfile, eap->arg, 0, 0);
set_option_direct(kOptErrorfile, CSTR_AS_OPTVAL(eap->arg), 0, 0);
}
char *enc = (*curbuf->b_p_menc != NUL) ? curbuf->b_p_menc : p_menc;