diff options
Diffstat (limited to 'src/nvim/optionstr.c')
-rw-r--r-- | src/nvim/optionstr.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c index 1bdfcbecb9..7278b1a12d 100644 --- a/src/nvim/optionstr.c +++ b/src/nvim/optionstr.c @@ -107,6 +107,7 @@ static char *(p_fdc_values[]) = { "auto", "auto:1", "auto:2", "auto:3", "auto:4" "auto:6", "auto:7", "auto:8", "auto:9", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; static char *(p_cb_values[]) = { "unnamed", "unnamedplus", NULL }; +static char *(p_spo_values[]) = { "camel", "noplainbuffer", NULL }; static char *(p_icm_values[]) = { "nosplit", "split", NULL }; static char *(p_jop_values[]) = { "stack", "view", NULL }; static char *(p_tpf_values[]) = { "BS", "HT", "FF", "ESC", "DEL", "C0", "C1", NULL }; @@ -252,7 +253,7 @@ void check_buf_options(buf_T *buf) /// Free the string allocated for an option. /// Checks for the string being empty_option. This may happen if we're out of -/// memory, vim_strsave() returned NULL, which was replaced by empty_option by +/// memory, xstrdup() returned NULL, which was replaced by empty_option by /// check_options(). /// Does NOT check for P_ALLOCED flag! void free_string_option(char *p) @@ -463,7 +464,7 @@ static char *check_mousescroll(char *string) for (;;) { char *end = vim_strchr(string, ','); - size_t length = end ? (size_t)(end - string) : STRLEN(string); + size_t length = end ? (size_t)(end - string) : strlen(string); // Both "ver:" and "hor:" are 4 bytes long. // They should be followed by at least one digit. @@ -531,7 +532,7 @@ static int check_signcolumn(char *val) } // check for 'auto:<NUMBER>-<NUMBER>' - if (STRLEN(val) == 8 + if (strlen(val) == 8 && !STRNCMP(val, "auto:", 5) && ascii_isdigit(val[5]) && val[6] == '-' @@ -682,7 +683,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf } } } else if (varp == &p_bex || varp == &p_pm) { // 'backupext' and 'patchmode' - if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex, + if (strcmp(*p_bex == '.' ? p_bex + 1 : p_bex, *p_pm == '.' ? p_pm + 1 : p_pm) == 0) { errmsg = e_backupext_and_patchmode_are_equal; } @@ -730,7 +731,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf } } } else if (varp == &p_hl) { // 'highlight' - if (STRCMP(*varp, HIGHLIGHT_INIT) != 0) { + if (strcmp(*varp, HIGHLIGHT_INIT) != 0) { errmsg = e_unsupportedoption; } } else if (varp == &p_jop) { // 'jumpoptions' @@ -822,13 +823,13 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf } if (errmsg == NULL) { - // canonize the value, so that STRCMP() can be used on it + // canonize the value, so that strcmp() can be used on it p = enc_canonize(*varp); xfree(*varp); *varp = p; if (varp == &p_enc) { // only encoding=utf-8 allowed - if (STRCMP(p_enc, "utf-8") != 0) { + if (strcmp(p_enc, "utf-8") != 0) { errmsg = e_unsupportedoption; } else { spell_reload(); @@ -1125,7 +1126,8 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf // When 'spellcapcheck' is set compile the regexp program. errmsg = compile_cap_prog(curwin->w_s); } else if (varp == &(curwin->w_s->b_p_spo)) { // 'spelloptions' - if (**varp != NUL && STRCMP("camel", *varp) != 0) { + if (opt_strings_flags(curwin->w_s->b_p_spo, p_spo_values, &(curwin->w_s->b_p_spo_flags), + true) != OK) { errmsg = e_invarg; } } else if (varp == &p_sps) { // 'spellsuggest' @@ -1256,7 +1258,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf if (*p_pt) { p = NULL; (void)replace_termcodes(p_pt, - STRLEN(p_pt), + strlen(p_pt), &p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL, CPO_TO_CPO_FLAGS); if (p != NULL) { @@ -1356,7 +1358,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf } else { if (opt_strings_flags(ve, p_ve_values, flags, true) != OK) { errmsg = e_invarg; - } else if (STRCMP(p_ve, oldval) != 0) { + } else if (strcmp(p_ve, oldval) != 0) { // Recompute cursor position in case the new 've' setting // changes something. validate_virtcol(); @@ -1391,7 +1393,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf if (!valid_filetype(*varp)) { errmsg = e_invarg; } else { - value_changed = STRCMP(oldval, *varp) != 0; + value_changed = strcmp(oldval, *varp) != 0; // Since we check the value, there is no need to set P_INSECURE, // even when the value comes from a modeline. @@ -1401,7 +1403,7 @@ char *did_set_string_option(int opt_idx, char **varp, char *oldval, char *errbuf if (!valid_filetype(*varp)) { errmsg = e_invarg; } else { - value_changed = STRCMP(oldval, *varp) != 0; + value_changed = strcmp(oldval, *varp) != 0; // Since we check the value, there is no need to set P_INSECURE, // even when the value comes from a modeline. @@ -1639,7 +1641,7 @@ static int opt_strings_flags(char *val, char **values, unsigned *flagp, bool lis return FAIL; } - size_t len = STRLEN(values[i]); + size_t len = strlen(values[i]); if (STRNCMP(values[i], val, len) == 0 && ((list && val[len] == ',') || val[len] == NUL)) { val += len + (val[len] == ','); |