From 9ae7d36ff5ebaf75597b442e10890bd77df01fbe Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Thu, 7 Dec 2023 00:40:48 +0600 Subject: refactor(options): split `get_option_value()` into smaller functions Problem: Currently, `get_option_value()` returns 3 separate things: The actual value of the option, whether the option is hidden, and the option flags. This makes the function difficult to refactor, modify or otherwise reason about. Solution: Split `get_option_value()` into 3 functions, each with a single purpose. This also affects `get_option_value_for()`. --- src/nvim/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/context.c') diff --git a/src/nvim/context.c b/src/nvim/context.c index 28a67061c6..63c0f8c20c 100644 --- a/src/nvim/context.c +++ b/src/nvim/context.c @@ -138,7 +138,7 @@ bool ctx_restore(Context *ctx, const int flags) free_ctx = true; } - OptVal op_shada = get_option_value("shada", NULL, OPT_GLOBAL, NULL); + OptVal op_shada = get_option_value(findoption("shada"), OPT_GLOBAL); set_option_value("shada", STATIC_CSTR_AS_OPTVAL("!,'100,%"), OPT_GLOBAL); if (flags & kCtxRegs) { -- cgit