From 34c44c355646311aa67fe53e1e5ce040789430c6 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Mon, 28 Oct 2024 19:49:16 +0600 Subject: refactor(options): option flags enum #30961 Problem: Currently we use macros with hardcoded flag values for option flags, which is messy and requires a lot of mental math for adding / removing option flags. Using macros for option flags also means that they cannot be used inside debuggers. Solution: Create a new `OptFlags` enum that stores all the option flags in an organized way that is easier to understand. --- src/nvim/optionstr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/nvim/optionstr.c') diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 651a9d20bf..e07fcf2f0e 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -419,9 +419,9 @@ const char *check_stl_option(char *s) /// often illegal in a file name. Be more permissive if "secure" is off. bool check_illegal_path_names(char *val, uint32_t flags) { - return (((flags & P_NFNAME) + return (((flags & kOptFlagNFname) && strpbrk(val, (secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL) - || ((flags & P_NDNAME) + || ((flags & kOptFlagNDname) && strpbrk(val, "*?[|;&<>\r\n") != NULL)); } @@ -1377,7 +1377,7 @@ const char *did_set_filetype_or_syntax(optset_T *args) args->os_value_changed = strcmp(args->os_oldval.string.data, *varp) != 0; - // Since we check the value, there is no need to set P_INSECURE, + // Since we check the value, there is no need to set kOptFlagInsecure, // even when the value comes from a modeline. args->os_value_checked = true; @@ -1658,7 +1658,7 @@ const char *did_set_keymap(optset_T *args) secure = secure_save; - // Since we check the value, there is no need to set P_INSECURE, + // Since we check the value, there is no need to set kOptFlagInsecure, // even when the value comes from a modeline. args->os_value_checked = true; -- cgit