aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorFamiu Haque <famiuhaque@proton.me>2024-01-10 04:15:22 +0600
committerGitHub <noreply@github.com>2024-01-10 06:15:22 +0800
commit10f36af84d4ccb0b626cd6c79c6ba2f2735a56fd (patch)
treecffc1614f18b97712a9fb332deba53a7b21dc0a4 /src/nvim/option.c
parent501cf323575864c847be892da1197daa8c3771a1 (diff)
downloadrneovim-10f36af84d4ccb0b626cd6c79c6ba2f2735a56fd.tar.gz
rneovim-10f36af84d4ccb0b626cd6c79c6ba2f2735a56fd.tar.bz2
rneovim-10f36af84d4ccb0b626cd6c79c6ba2f2735a56fd.zip
refactor(options): remove `OPT_FREE` (#26963)
Problem: `OPT_FREE` macro doesn't seem to do anything as `P_ALLOCED` already handles allocations. Solution: Remove `OPT_FREE`.
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index a46e6fed34..1561361771 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -370,9 +370,6 @@ void set_init_1(bool clean_arg)
check_win_options(curwin);
check_options();
- // Set all options to their default value
- set_options_default(OPT_FREE);
-
// set 'laststatus'
last_status(false);
@@ -433,7 +430,7 @@ static void set_option_default(const OptIndex opt_idx, int opt_flags)
if (opt->indir != PV_NONE) {
set_string_option_direct(opt_idx, opt->def_val, opt_flags, 0);
} else {
- if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED)) {
+ if (flags & P_ALLOCED) {
free_string_option(*(char **)(varp));
}
*(char **)varp = opt->def_val;
@@ -482,7 +479,7 @@ static void set_option_default(const OptIndex opt_idx, int opt_flags)
/// Set all options (except terminal options) to their default value.
///
-/// @param opt_flags OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL
+/// @param opt_flags Option flags.
static void set_options_default(int opt_flags)
{
for (OptIndex opt_idx = 0; opt_idx < kOptIndexCount; opt_idx++) {
@@ -1431,7 +1428,7 @@ int do_set(char *arg, int opt_flags)
if (*arg == '&') {
arg++;
// Only for :set command set global value of local options.
- set_options_default(OPT_FREE | opt_flags);
+ set_options_default(opt_flags);
didset_options();
didset_options2();
ui_refresh_options();
@@ -6216,7 +6213,7 @@ void set_fileformat(int eol_style, int opt_flags)
// p is NULL if "eol_style" is EOL_UNKNOWN.
if (p != NULL) {
- set_string_option_direct(kOptFileformat, p, OPT_FREE | opt_flags, 0);
+ set_string_option_direct(kOptFileformat, p, opt_flags, 0);
}
// This may cause the buffer to become (un)modified.