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

@@ -712,7 +712,7 @@ char *au_event_disable(char *what)
} else {
STRCAT(new_ei, what);
}
set_string_option_direct(kOptEventignore, new_ei, 0, SID_NONE);
set_option_direct(kOptEventignore, CSTR_AS_OPTVAL(new_ei), 0, SID_NONE);
xfree(new_ei);
return save_ei;
}
@@ -720,7 +720,7 @@ char *au_event_disable(char *what)
void au_event_restore(char *old_ei)
{
if (old_ei != NULL) {
set_string_option_direct(kOptEventignore, old_ei, 0, SID_NONE);
set_option_direct(kOptEventignore, CSTR_AS_OPTVAL(old_ei), 0, SID_NONE);
xfree(old_ei);
}
}