Mercurial > vim
diff src/evalfunc.c @ 18777:3a68dc2a1bc1 v8.1.2378
patch 8.1.2378: using old C style comments
Commit: https://github.com/vim/vim/commit/5d18efecfd6c45d69f55268948a22cd0465bb955
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 1 21:11:22 2019 +0100
patch 8.1.2378: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 01 Dec 2019 21:15:03 +0100 |
parents | 49b78d6465e5 |
children | bf8eb950df61 |
line wrap: on
line diff
--- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1290,7 +1290,7 @@ f_balloon_split(typval_T *argvars, typva int size = split_message(msg, &array); int i; - /* Skip the first and last item, they are always empty. */ + // Skip the first and last item, they are always empty. for (i = 1; i < size - 1; ++i) list_append_string(rettv->vval.v_list, array[i].pum_text, -1); while (size > 0) @@ -1322,7 +1322,7 @@ tv_get_buf(typval_T *tv, int curtab_only buf = buflist_find_by_name(name, curtab_only); - /* If not found, try expanding the name, like done for bufexists(). */ + // If not found, try expanding the name, like done for bufexists(). if (buf == NULL) buf = find_buffer(tv); @@ -1357,7 +1357,7 @@ f_byte2line(typval_T *argvars UNUSED, ty #else long boff = 0; - boff = tv_get_number(&argvars[0]) - 1; /* boff gets -1 on type error */ + boff = tv_get_number(&argvars[0]) - 1; // boff gets -1 on type error if (boff < 0) rettv->vval.v_number = -1; else @@ -1382,7 +1382,7 @@ byteidx(typval_T *argvars, typval_T *ret t = str; for ( ; idx > 0; idx--) { - if (*t == NUL) /* EOL reached */ + if (*t == NUL) // EOL reached return; if (enc_utf8 && comp) t += utf_ptr2len(t); @@ -1438,7 +1438,7 @@ f_call(typval_T *argvars, typval_T *rett else func = tv_get_string(&argvars[0]); if (*func == NUL) - return; /* type error or empty name */ + return; // type error or empty name if (argvars[2].v_type != VAR_UNKNOWN) { @@ -1533,7 +1533,7 @@ f_col(typval_T *argvars, typval_T *rettv { if (fp->col == MAXCOL) { - /* '> can be MAXCOL, get the length of the line then */ + // '> can be MAXCOL, get the length of the line then if (fp->lnum <= curbuf->b_ml.ml_line_count) col = (colnr_T)STRLEN(ml_get(fp->lnum)) + 1; else @@ -1542,8 +1542,8 @@ f_col(typval_T *argvars, typval_T *rettv else { col = fp->col + 1; - /* col(".") when the cursor is on the NUL at the end of the line - * because of "coladd" can be seen as an extra column. */ + // col(".") when the cursor is on the NUL at the end of the line + // because of "coladd" can be seen as an extra column. if (virtual_active() && fp == &curwin->w_cursor) { char_u *p = ml_get_cursor(); @@ -1701,16 +1701,16 @@ f_cursor(typval_T *argvars, typval_T *re coladd = (long)tv_get_number_chk(&argvars[2], NULL); } if (line < 0 || col < 0 || coladd < 0) - return; /* type error; errmsg already given */ + return; // type error; errmsg already given if (line > 0) curwin->w_cursor.lnum = line; if (col > 0) curwin->w_cursor.col = col - 1; curwin->w_cursor.coladd = coladd; - /* Make sure the cursor is in a valid position. */ + // Make sure the cursor is in a valid position. check_cursor(); - /* Correct cursor for multi-byte character. */ + // Correct cursor for multi-byte character. if (has_mbyte) mb_adjust_cursor(); @@ -1949,9 +1949,9 @@ execute_redir_str(char_u *value, int val int len; if (value_len == -1) - len = (int)STRLEN(value); /* Append the entire string */ + len = (int)STRLEN(value); // Append the entire string else - len = value_len; /* Append only "value_len" characters */ + len = value_len; // Append only "value_len" characters if (ga_grow(&redir_execute_ga, len) == OK) { mch_memmove((char *)redir_execute_ga.ga_data @@ -2009,7 +2009,7 @@ execute_common(typval_T *argvars, typval { list = argvars[arg_off].vval.v_list; if (list == NULL || list->lv_first == NULL) - /* empty list, no commands, empty output */ + // empty list, no commands, empty output return; ++list->lv_refcount; } @@ -2059,7 +2059,7 @@ execute_common(typval_T *argvars, typval --list->lv_refcount; } - /* Need to append a NUL to the result. */ + // Need to append a NUL to the result. if (ga_grow(&redir_execute_ga, 1) == OK) { ((char *)redir_execute_ga.ga_data)[redir_execute_ga.ga_len] = NUL; @@ -2109,27 +2109,27 @@ f_exists(typval_T *argvars, typval_T *re int n = FALSE; p = tv_get_string(&argvars[0]); - if (*p == '$') /* environment variable */ - { - /* first try "normal" environment variables (fast) */ + if (*p == '$') // environment variable + { + // first try "normal" environment variables (fast) if (mch_getenv(p + 1) != NULL) n = TRUE; else { - /* try expanding things like $VIM and ${HOME} */ + // try expanding things like $VIM and ${HOME} p = expand_env_save(p); if (p != NULL && *p != '$') n = TRUE; vim_free(p); } } - else if (*p == '&' || *p == '+') /* option */ + else if (*p == '&' || *p == '+') // option { n = (get_option_tv(&p, NULL, TRUE) == OK); if (*skipwhite(p) != NUL) - n = FALSE; /* trailing garbage */ - } - else if (*p == '*') /* internal or user defined function */ + n = FALSE; // trailing garbage + } + else if (*p == '*') // internal or user defined function { n = function_exists(p + 1, FALSE); } @@ -2144,7 +2144,7 @@ f_exists(typval_T *argvars, typval_T *re else n = au_exists(p + 1); } - else /* internal variable */ + else // internal variable { n = var_exists(p); } @@ -2207,8 +2207,8 @@ f_expand(typval_T *argvars, typval_T *re } else { - /* When the optional second argument is non-zero, don't remove matches - * for 'wildignore' and don't put matches for 'suffixes' at the end. */ + // When the optional second argument is non-zero, don't remove matches + // for 'wildignore' and don't put matches for 'suffixes' at the end. if (argvars[1].v_type != VAR_UNKNOWN && tv_get_number_chk(&argvars[1], &error)) options |= WILD_KEEP_ALL; @@ -2281,9 +2281,9 @@ f_feedkeys(typval_T *argvars, typval_T * int lowlevel = FALSE; char_u *keys_esc; - /* This is not allowed in the sandbox. If the commands would still be - * executed in the sandbox it would be OK, but it probably happens later, - * when "sandbox" is no longer set. */ + // This is not allowed in the sandbox. If the commands would still be + // executed in the sandbox it would be OK, but it probably happens later, + // when "sandbox" is no longer set. if (check_secure()) return; @@ -2309,8 +2309,8 @@ f_feedkeys(typval_T *argvars, typval_T * if (*keys != NUL || execute) { - /* Need to escape K_SPECIAL and CSI before putting the string in the - * typeahead buffer. */ + // Need to escape K_SPECIAL and CSI before putting the string in the + // typeahead buffer. keys_esc = vim_strsave_escape_csi(keys); if (keys_esc != NULL) { @@ -2339,7 +2339,7 @@ f_feedkeys(typval_T *argvars, typval_T * { int save_msg_scroll = msg_scroll; - /* Avoid a 1 second delay when the keys start Insert mode. */ + // Avoid a 1 second delay when the keys start Insert mode. msg_scroll = FALSE; if (!dangerous) @@ -2446,19 +2446,19 @@ common_function(typval_T *argvars, typva if (argvars[0].v_type == VAR_FUNC) { - /* function(MyFunc, [arg], dict) */ + // function(MyFunc, [arg], dict) s = argvars[0].vval.v_string; } else if (argvars[0].v_type == VAR_PARTIAL && argvars[0].vval.v_partial != NULL) { - /* function(dict.MyFunc, [arg]) */ + // function(dict.MyFunc, [arg]) arg_pt = argvars[0].vval.v_partial; s = partial_name(arg_pt); } else { - /* function('MyFunc', [arg], dict) */ + // function('MyFunc', [arg], dict) s = tv_get_string(&argvars[0]); use_string = TRUE; } @@ -2475,7 +2475,7 @@ common_function(typval_T *argvars, typva if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s)) || (is_funcref && trans_name == NULL)) semsg(_(e_invarg2), use_string ? tv_get_string(&argvars[0]) : s); - /* Don't check an autoload name for existence here. */ + // Don't check an autoload name for existence here. else if (trans_name != NULL && (is_funcref ? find_func(trans_name) == NULL : !translated_function_exists(trans_name))) @@ -2491,10 +2491,10 @@ common_function(typval_T *argvars, typva char sid_buf[25]; int off = *s == 's' ? 2 : 5; - /* Expand s: and <SID> into <SNR>nr_, so that the function can - * also be called from another script. Using trans_function_name() - * would also work, but some plugins depend on the name being - * printable text. */ + // Expand s: and <SID> into <SNR>nr_, so that the function can + // also be called from another script. Using trans_function_name() + // would also work, but some plugins depend on the name being + // printable text. sprintf(sid_buf, "<SNR>%ld_", (long)current_sctx.sc_sid); name = alloc(STRLEN(sid_buf) + STRLEN(s + off) + 1); if (name != NULL) @@ -2510,15 +2510,15 @@ common_function(typval_T *argvars, typva { if (argvars[2].v_type != VAR_UNKNOWN) { - /* function(name, [args], dict) */ + // function(name, [args], dict) arg_idx = 1; dict_idx = 2; } else if (argvars[1].v_type == VAR_DICT) - /* function(name, dict) */ + // function(name, dict) dict_idx = 1; else - /* function(name, [args]) */ + // function(name, [args]) arg_idx = 1; if (dict_idx > 0) { @@ -2554,7 +2554,7 @@ common_function(typval_T *argvars, typva { partial_T *pt = ALLOC_CLEAR_ONE(partial_T); - /* result is a VAR_PARTIAL */ + // result is a VAR_PARTIAL if (pt == NULL) vim_free(name); else @@ -2586,18 +2586,18 @@ common_function(typval_T *argvars, typva copy_tv(&li->li_tv, &pt->pt_argv[i++]); } - /* For "function(dict.func, [], dict)" and "func" is a partial - * use "dict". That is backwards compatible. */ + // For "function(dict.func, [], dict)" and "func" is a partial + // use "dict". That is backwards compatible. if (dict_idx > 0) { - /* The dict is bound explicitly, pt_auto is FALSE. */ + // The dict is bound explicitly, pt_auto is FALSE. pt->pt_dict = argvars[dict_idx].vval.v_dict; ++pt->pt_dict->dv_refcount; } else if (arg_pt != NULL) { - /* If the dict was bound automatically the result is also - * bound automatically. */ + // If the dict was bound automatically the result is also + // bound automatically. pt->pt_dict = arg_pt->pt_dict; pt->pt_auto = arg_pt->pt_auto; if (pt->pt_dict != NULL) @@ -2628,7 +2628,7 @@ common_function(typval_T *argvars, typva } else { - /* result is a VAR_FUNC */ + // result is a VAR_FUNC rettv->v_type = VAR_FUNC; rettv->vval.v_string = name; func_ref(name); @@ -2662,8 +2662,8 @@ f_function(typval_T *argvars, typval_T * static void f_garbagecollect(typval_T *argvars, typval_T *rettv UNUSED) { - /* This is postponed until we are back at the toplevel, because we may be - * using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". */ + // This is postponed until we are back at the toplevel, because we may be + // using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". want_garbage_collect = TRUE; if (argvars[0].v_type != VAR_UNKNOWN && tv_get_number(&argvars[0]) == 1) @@ -2922,19 +2922,19 @@ f_getfontname(typval_T *argvars UNUSED, if (argvars[0].v_type == VAR_UNKNOWN) { - /* Get the "Normal" font. Either the name saved by - * hl_set_font_name() or from the font ID. */ + // Get the "Normal" font. Either the name saved by + // hl_set_font_name() or from the font ID. font = gui.norm_font; name = hl_get_font_name(); } else { name = tv_get_string(&argvars[0]); - if (STRCMP(name, "*") == 0) /* don't use font dialog */ + if (STRCMP(name, "*") == 0) // don't use font dialog return; font = gui_mch_get_font(name, FALSE); if (font == NOFONT) - return; /* Invalid font name, return empty string. */ + return; // Invalid font name, return empty string. } rettv->vval.v_string = gui_mch_get_fontname(font, name); if (argvars[0].v_type != VAR_UNKNOWN) @@ -3137,7 +3137,7 @@ f_getregtype(typval_T *argvars, typval_T if (argvars[0].v_type != VAR_UNKNOWN) { strregname = tv_get_string_chk(&argvars[0]); - if (strregname == NULL) /* type error; errmsg already given */ + if (strregname == NULL) // type error; errmsg already given { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; @@ -3145,7 +3145,7 @@ f_getregtype(typval_T *argvars, typval_T } } else - /* Default to v:register */ + // Default to v:register strregname = get_vim_var_str(VV_REG); regname = (strregname == NULL ? '"' : *strregname); @@ -3188,7 +3188,7 @@ f_gettagstack(typval_T *argvars, typval_ get_tagstack(wp, rettv->vval.v_dict); } -/* for VIM_VERSION_ defines */ +// for VIM_VERSION_ defines #include "version.h" /* @@ -3221,11 +3221,11 @@ f_has(typval_T *argvars, typval_T *rettv "linux", #endif #ifdef MACOS_X - "mac", /* Mac OS X (and, once, Mac OS Classic) */ - "osx", /* Mac OS X */ + "mac", // Mac OS X (and, once, Mac OS Classic) + "osx", // Mac OS X # ifdef MACOS_X_DARWIN - "macunix", /* Mac OS X, with the darwin feature */ - "osxdarwin", /* synonym for macunix */ + "macunix", // Mac OS X, with the darwin feature + "osxdarwin", // synonym for macunix # endif #endif #ifdef __QNX__ @@ -3272,7 +3272,7 @@ f_has(typval_T *argvars, typval_T *rettv #endif #ifdef FEAT_BEVAL_GUI "balloon_eval", -# ifndef FEAT_GUI_MSWIN /* other GUIs always have multiline balloons */ +# ifndef FEAT_GUI_MSWIN // other GUIs always have multiline balloons "balloon_multiline", # endif #endif @@ -3347,8 +3347,8 @@ f_has(typval_T *argvars, typval_T *rettv #ifdef FEAT_EMACS_TAGS "emacs_tags", #endif - "eval", /* always present, of course! */ - "ex_extra", /* graduated feature */ + "eval", // always present, of course! + "ex_extra", // graduated feature #ifdef FEAT_SEARCH_EXTRA "extra_search", #endif @@ -3422,7 +3422,7 @@ f_has(typval_T *argvars, typval_T *rettv #ifdef FEAT_KEYMAP "keymap", #endif - "lambda", /* always with FEAT_EVAL, since 7.4.2120 with closure */ + "lambda", // always with FEAT_EVAL, since 7.4.2120 with closure #ifdef FEAT_LANGMAP "langmap", #endif @@ -3629,7 +3629,7 @@ f_has(typval_T *argvars, typval_T *rettv #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) "unnamedplus", #endif - "user-commands", /* was accidentally included in 5.4 */ + "user-commands", // was accidentally included in 5.4 "user_commands", #ifdef FEAT_VARTABS "vartabs", @@ -3670,7 +3670,7 @@ f_has(typval_T *argvars, typval_T *rettv #endif #ifdef FEAT_XPM_W32 "xpm", - "xpm_w32", /* for backward compatibility */ + "xpm_w32", // for backward compatibility #else # if defined(HAVE_XPM) "xpm", @@ -3715,7 +3715,7 @@ f_has(typval_T *argvars, typval_T *rettv int major = atoi((char *)name + 6); int minor = atoi((char *)name + 8); - /* Expect "patch-9.9.01234". */ + // Expect "patch-9.9.01234". n = (major < VIM_VERSION_MAJOR || (major == VIM_VERSION_MAJOR && (minor < VIM_VERSION_MINOR @@ -3791,7 +3791,7 @@ f_has(typval_T *argvars, typval_T *rettv n = (gui.in_use || gui.starting); # ifdef FEAT_BROWSE else if (STRICMP(name, "browse") == 0) - n = gui.in_use; /* gui_mch_browse() works when GUI is running */ + n = gui.in_use; // gui_mch_browse() works when GUI is running # endif #endif #ifdef FEAT_SYN_HL @@ -3929,7 +3929,7 @@ f_iconv(typval_T *argvars UNUSED, typval vimconv.vc_type = CONV_NONE; convert_setup(&vimconv, from, to); - /* If the encodings are equal, no conversion needed. */ + // If the encodings are equal, no conversion needed. if (vimconv.vc_type == CONV_NONE) rettv->vval.v_string = vim_strsave(str); else @@ -3999,8 +3999,8 @@ f_index(typval_T *argvars, typval_T *ret item = l->lv_first; if (argvars[2].v_type != VAR_UNKNOWN) { - /* Start at specified item. Use the cached index that list_find() - * sets, so that a negative number also works. */ + // Start at specified item. Use the cached index that list_find() + // sets, so that a negative number also works. item = list_find(l, (long)tv_get_number_chk(&argvars[2], &error)); idx = l->lv_idx; if (argvars[3].v_type != VAR_UNKNOWN) @@ -4037,7 +4037,7 @@ f_input(typval_T *argvars, typval_T *ret f_inputdialog(typval_T *argvars, typval_T *rettv) { #if defined(FEAT_GUI_TEXTDIALOG) - /* Use a GUI dialog if the GUI is running and 'c' is not in 'guioptions' */ + // Use a GUI dialog if the GUI is running and 'c' is not in 'guioptions' if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL) { char_u *message; @@ -4082,8 +4082,8 @@ f_inputlist(typval_T *argvars, typval_T int mouse_used; #ifdef NO_CONSOLE_INPUT - /* While starting up, there is no place to enter text. When running tests - * with --not-a-term we assume feedkeys() will be used. */ + // While starting up, there is no place to enter text. When running tests + // with --not-a-term we assume feedkeys() will be used. if (no_console_input() && !is_not_a_term()) return; #endif @@ -4094,8 +4094,8 @@ f_inputlist(typval_T *argvars, typval_T } msg_start(); - msg_row = Rows - 1; /* for when 'cmdheight' > 1 */ - lines_left = Rows; /* avoid more prompt */ + msg_row = Rows - 1; // for when 'cmdheight' > 1 + lines_left = Rows; // avoid more prompt msg_scroll = TRUE; msg_clr_eos(); @@ -4105,7 +4105,7 @@ f_inputlist(typval_T *argvars, typval_T msg_putchar('\n'); } - /* Ask for choice. */ + // Ask for choice. selected = prompt_for_number(&mouse_used); if (mouse_used) selected -= lines_left; @@ -4126,12 +4126,12 @@ f_inputrestore(typval_T *argvars UNUSED, --ga_userinput.ga_len; restore_typeahead((tasave_T *)(ga_userinput.ga_data) + ga_userinput.ga_len); - /* default return is zero == OK */ + // default return is zero == OK } else if (p_verbose > 1) { verb_msg(_("called inputrestore() more often than inputsave()")); - rettv->vval.v_number = 1; /* Failed */ + rettv->vval.v_number = 1; // Failed } } @@ -4141,16 +4141,16 @@ f_inputrestore(typval_T *argvars UNUSED, static void f_inputsave(typval_T *argvars UNUSED, typval_T *rettv) { - /* Add an entry to the stack of typeahead storage. */ + // Add an entry to the stack of typeahead storage. if (ga_grow(&ga_userinput, 1) == OK) { save_typeahead((tasave_T *)(ga_userinput.ga_data) + ga_userinput.ga_len); ++ga_userinput.ga_len; - /* default return is zero == OK */ + // default return is zero == OK } else - rettv->vval.v_number = 1; /* Failed */ + rettv->vval.v_number = 1; // Failed } /* @@ -4224,11 +4224,10 @@ f_islocked(typval_T *argvars, typval_T * di = find_var(lv.ll_name, NULL, TRUE); if (di != NULL) { - /* Consider a variable locked when: - * 1. the variable itself is locked - * 2. the value of the variable is locked. - * 3. the List or Dict value is locked. - */ + // Consider a variable locked when: + // 1. the variable itself is locked + // 2. the value of the variable is locked. + // 3. the List or Dict value is locked. rettv->vval.v_number = ((di->di_flags & DI_FLAGS_LOCK) || tv_islocked(&di->di_tv)); } @@ -4238,10 +4237,10 @@ f_islocked(typval_T *argvars, typval_T * else if (lv.ll_newkey != NULL) semsg(_(e_dictkey), lv.ll_newkey); else if (lv.ll_list != NULL) - /* List item. */ + // List item. rettv->vval.v_number = tv_islocked(&lv.ll_li->li_tv); else - /* Dictionary item. */ + // Dictionary item. rettv->vval.v_number = tv_islocked(&lv.ll_di->di_tv); } } @@ -4338,7 +4337,7 @@ libcall_common(typval_T *argvars UNUSED, return; #ifdef FEAT_LIBCALL - /* The first two args must be strings, otherwise it's meaningless */ + // The first two args must be strings, otherwise it's meaningless if (argvars[0].v_type == VAR_STRING && argvars[1].v_type == VAR_STRING) { string_in = NULL; @@ -4518,11 +4517,11 @@ f_mapcheck(typval_T *argvars, typval_T * typedef enum { - MATCH_END, /* matchend() */ - MATCH_MATCH, /* match() */ - MATCH_STR, /* matchstr() */ - MATCH_LIST, /* matchlist() */ - MATCH_POS /* matchstrpos() */ + MATCH_END, // matchend() + MATCH_MATCH, // match() + MATCH_STR, // matchstr() + MATCH_LIST, // matchlist() + MATCH_POS // matchstrpos() } matchtype_T; static void @@ -4545,15 +4544,15 @@ find_some_match(typval_T *argvars, typva long idx = 0; char_u *tofree = NULL; - /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ + // Make 'cpoptions' empty, the 'l' flag should not be used here. save_cpo = p_cpo; p_cpo = (char_u *)""; rettv->vval.v_number = -1; if (type == MATCH_LIST || type == MATCH_POS) { - /* type MATCH_LIST: return empty list when there are no matches. - * type MATCH_POS: return ["", -1, -1, -1] */ + // type MATCH_LIST: return empty list when there are no matches. + // type MATCH_POS: return ["", -1, -1, -1] if (rettv_list_alloc(rettv) == FAIL) goto theend; if (type == MATCH_POS @@ -4605,7 +4604,7 @@ find_some_match(typval_T *argvars, typva li = list_find(l, start); if (li == NULL) goto theend; - idx = l->lv_idx; /* use the cached index */ + idx = l->lv_idx; // use the cached index } else { @@ -4613,9 +4612,9 @@ find_some_match(typval_T *argvars, typva start = 0; if (start > len) goto theend; - /* When "count" argument is there ignore matches before "start", - * otherwise skip part of the string. Differs when pattern is "^" - * or "\<". */ + // When "count" argument is there ignore matches before "start", + // otherwise skip part of the string. Differs when pattern is "^" + // or "\<". if (argvars[3].v_type != VAR_UNKNOWN) startcol = start; else @@ -4658,7 +4657,7 @@ find_some_match(typval_T *argvars, typva if (l == NULL && !match) break; - /* Advance to just after the match. */ + // Advance to just after the match. if (l != NULL) { li = li->li_next; @@ -4700,7 +4699,7 @@ find_some_match(typval_T *argvars, typva { int i; - /* return list with matched string and submatches */ + // return list with matched string and submatches for (i = 0; i < NSUBEXP; ++i) { if (regmatch.endp[i] == NULL) @@ -4718,7 +4717,7 @@ find_some_match(typval_T *argvars, typva } else if (type == MATCH_STR) { - /* return matched string */ + // return matched string if (l != NULL) copy_tv(&li->li_tv, rettv); else @@ -4743,7 +4742,7 @@ find_some_match(typval_T *argvars, typva theend: if (type == MATCH_POS && l == NULL && rettv->vval.v_list != NULL) - /* matchstrpos() without a list: drop the second item. */ + // matchstrpos() without a list: drop the second item. listitem_remove(rettv->vval.v_list, rettv->vval.v_list->lv_first->li_next); vim_free(tofree); @@ -5016,10 +5015,10 @@ f_prevnonblank(typval_T *argvars, typval rettv->vval.v_number = lnum; } -/* This dummy va_list is here because: - * - passing a NULL pointer doesn't work when va_list isn't a pointer - * - locally in the function results in a "used before set" warning - * - using va_start() to initialize it gives "function with fixed args" error */ +// This dummy va_list is here because: +// - passing a NULL pointer doesn't work when va_list isn't a pointer +// - locally in the function results in a "used before set" warning +// - using va_start() to initialize it gives "function with fixed args" error static va_list ap; /* @@ -5037,7 +5036,7 @@ f_printf(typval_T *argvars, typval_T *re rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - /* Get the required length, allocate the buffer and do it for real. */ + // Get the required length, allocate the buffer and do it for real. did_emsg = FALSE; fmt = (char *)tv_get_string_buf(&argvars[0], buf); len = vim_vsnprintf_typval(NULL, 0, fmt, ap, argvars + 1); @@ -5244,7 +5243,7 @@ f_range(typval_T *argvars, typval_T *ret } if (error) - return; /* type error; errmsg already given */ + return; // type error; errmsg already given if (stride == 0) emsg(_("E726: Stride is zero")); else if (stride > 0 ? end + 1 < start : end - 1 > start) @@ -5312,7 +5311,7 @@ list2proftime(typval_T *arg, proftime_T # endif return error ? FAIL : OK; } -#endif /* FEAT_RELTIME */ +#endif // FEAT_RELTIME /* * "reltime()" function @@ -5326,7 +5325,7 @@ f_reltime(typval_T *argvars UNUSED, typv if (argvars[0].v_type == VAR_UNKNOWN) { - /* No arguments: get current time. */ + // No arguments: get current time. profile_start(&res); } else if (argvars[1].v_type == VAR_UNKNOWN) @@ -5337,7 +5336,7 @@ f_reltime(typval_T *argvars UNUSED, typv } else { - /* Two arguments: compute the difference. */ + // Two arguments: compute the difference. if (list2proftime(&argvars[0], &start) == FAIL || list2proftime(&argvars[1], &res) == FAIL) return; @@ -5456,7 +5455,7 @@ remote_common(typval_T *argvars, typval_ server_name = tv_get_string_chk(&argvars[0]); if (server_name == NULL) - return; /* type error; errmsg already given */ + return; // type error; errmsg already given keys = tv_get_string_buf(&argvars[1], buf); # ifdef MSWIN if (serverSendToVim(server_name, keys, &r, &w, expr, timeout, TRUE) < 0) @@ -5517,7 +5516,7 @@ f_remote_foreground(typval_T *argvars UN { #ifdef FEAT_CLIENTSERVER # ifdef MSWIN - /* On Win32 it's done in this application. */ + // On Win32 it's done in this application. { char_u *server_name = tv_get_string_chk(&argvars[0]); @@ -5525,7 +5524,7 @@ f_remote_foreground(typval_T *argvars UN serverForeground(server_name); } # else - /* Send a foreground() expression to the server. */ + // Send a foreground() expression to the server. argvars[1].v_type = VAR_STRING; argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()"); argvars[2].v_type = VAR_UNKNOWN; @@ -5557,7 +5556,7 @@ f_remote_peek(typval_T *argvars UNUSED, if (serverid == NULL) { rettv->vval.v_number = -1; - return; /* type error; errmsg already given */ + return; // type error; errmsg already given } # ifdef MSWIN sscanf((const char *)serverid, SCANF_HEX_LONG_U, &n); @@ -5604,7 +5603,7 @@ f_remote_read(typval_T *argvars UNUSED, { int timeout = 0; # ifdef MSWIN - /* The server's HWND is encoded in the 'id' parameter */ + // The server's HWND is encoded in the 'id' parameter long_u n = 0; # endif @@ -5651,7 +5650,7 @@ f_remote_startserver(typval_T *argvars U char_u *server = tv_get_string_chk(&argvars[0]); if (server == NULL) - return; /* type error; errmsg already given */ + return; // type error; errmsg already given if (serverName != NULL) emsg(_("E941: already started a server")); else @@ -5728,14 +5727,14 @@ f_repeat(typval_T *argvars, typval_T *re } } -#define SP_NOMOVE 0x01 /* don't move cursor */ -#define SP_REPEAT 0x02 /* repeat to find outer pair */ -#define SP_RETCOUNT 0x04 /* return matchcount */ -#define SP_SETPCMARK 0x08 /* set previous context mark */ -#define SP_START 0x10 /* accept match at start position */ -#define SP_SUBPAT 0x20 /* return nr of matching sub-pattern */ -#define SP_END 0x40 /* leave cursor at end of match */ -#define SP_COLUMN 0x80 /* start at cursor column */ +#define SP_NOMOVE 0x01 // don't move cursor +#define SP_REPEAT 0x02 // repeat to find outer pair +#define SP_RETCOUNT 0x04 // return matchcount +#define SP_SETPCMARK 0x08 // set previous context mark +#define SP_START 0x10 // accept match at start position +#define SP_SUBPAT 0x20 // return nr of matching sub-pattern +#define SP_END 0x40 // leave cursor at end of match +#define SP_COLUMN 0x80 // start at cursor column /* * Get flags for a search function. @@ -5754,7 +5753,7 @@ get_search_arg(typval_T *varp, int *flag { flags = tv_get_string_buf_chk(varp, nbuf); if (flags == NULL) - return 0; /* type error; errmsg already given */ + return 0; // type error; errmsg already given while (*flags != NUL) { switch (*flags) @@ -5803,7 +5802,7 @@ search_cmn(typval_T *argvars, pos_T *mat pos_T save_cursor; int save_p_ws = p_ws; int dir; - int retval = 0; /* default: FAIL */ + int retval = 0; // default: FAIL long lnum_stop = 0; #ifdef FEAT_RELTIME proftime_T tm; @@ -5814,7 +5813,7 @@ search_cmn(typval_T *argvars, pos_T *mat searchit_arg_T sia; pat = tv_get_string(&argvars[0]); - dir = get_search_arg(&argvars[1], flagsp); /* may set p_ws */ + dir = get_search_arg(&argvars[1], flagsp); // may set p_ws if (dir == 0) goto theend; flags = *flagsp; @@ -5825,7 +5824,7 @@ search_cmn(typval_T *argvars, pos_T *mat if (flags & SP_COLUMN) options |= SEARCH_COL; - /* Optional arguments: line number to stop searching and timeout. */ + // Optional arguments: line number to stop searching and timeout. if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) { lnum_stop = (long)tv_get_number_chk(&argvars[2], NULL); @@ -5842,7 +5841,7 @@ search_cmn(typval_T *argvars, pos_T *mat } #ifdef FEAT_RELTIME - /* Set the time limit, if there is one. */ + // Set the time limit, if there is one. profile_setlimit(time_limit, &tm); #endif @@ -5878,16 +5877,16 @@ search_cmn(typval_T *argvars, pos_T *mat curwin->w_cursor = pos; if (match_pos != NULL) { - /* Store the match cursor position */ + // Store the match cursor position match_pos->lnum = pos.lnum; match_pos->col = pos.col + 1; } - /* "/$" will put the cursor after the end of the line, may need to - * correct that here */ + // "/$" will put the cursor after the end of the line, may need to + // correct that here check_cursor(); } - /* If 'n' flag is used: restore cursor position. */ + // If 'n' flag is used: restore cursor position. if (flags & SP_NOMOVE) curwin->w_cursor = save_cursor; else @@ -6098,7 +6097,7 @@ f_searchdecl(typval_T *argvars, typval_T int error = FALSE; char_u *name; - rettv->vval.v_number = 1; /* default: FAIL */ + rettv->vval.v_number = 1; // default: FAIL name = tv_get_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) @@ -6125,26 +6124,25 @@ searchpair_cmn(typval_T *argvars, pos_T int flags = 0; char_u nbuf1[NUMBUFLEN]; char_u nbuf2[NUMBUFLEN]; - int retval = 0; /* default: FAIL */ + int retval = 0; // default: FAIL long lnum_stop = 0; long time_limit = 0; - /* Get the three pattern arguments: start, middle, end. Will result in an - * error if not a valid argument. */ + // Get the three pattern arguments: start, middle, end. Will result in an + // error if not a valid argument. spat = tv_get_string_chk(&argvars[0]); mpat = tv_get_string_buf_chk(&argvars[1], nbuf1); epat = tv_get_string_buf_chk(&argvars[2], nbuf2); if (spat == NULL || mpat == NULL || epat == NULL) - goto theend; /* type error */ - - /* Handle the optional fourth argument: flags */ - dir = get_search_arg(&argvars[3], &flags); /* may set p_ws */ + goto theend; // type error + + // Handle the optional fourth argument: flags + dir = get_search_arg(&argvars[3], &flags); // may set p_ws if (dir == 0) goto theend; - /* Don't accept SP_END or SP_SUBPAT. - * Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set. - */ + // Don't accept SP_END or SP_SUBPAT. + // Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set. if ((flags & (SP_END | SP_SUBPAT)) != 0 || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) { @@ -6152,11 +6150,11 @@ searchpair_cmn(typval_T *argvars, pos_T goto theend; } - /* Using 'r' implies 'W', otherwise it doesn't work. */ + // Using 'r' implies 'W', otherwise it doesn't work. if (flags & SP_REPEAT) p_ws = FALSE; - /* Optional fifth argument: skip expression */ + // Optional fifth argument: skip expression if (argvars[3].v_type == VAR_UNKNOWN || argvars[4].v_type == VAR_UNKNOWN) skip = NULL; @@ -6166,7 +6164,7 @@ searchpair_cmn(typval_T *argvars, pos_T if (skip->v_type != VAR_FUNC && skip->v_type != VAR_PARTIAL && skip->v_type != VAR_STRING) { - /* Type error */ + // Type error semsg(_(e_invarg2), tv_get_string(&argvars[4])); goto theend; } @@ -6240,15 +6238,15 @@ f_searchpairpos(typval_T *argvars, typva */ long do_searchpair( - char_u *spat, /* start pattern */ - char_u *mpat, /* middle pattern */ - char_u *epat, /* end pattern */ - int dir, /* BACKWARD or FORWARD */ - typval_T *skip, /* skip expression */ - int flags, /* SP_SETPCMARK and other SP_ values */ + char_u *spat, // start pattern + char_u *mpat, // middle pattern + char_u *epat, // end pattern + int dir, // BACKWARD or FORWARD + typval_T *skip, // skip expression + int flags, // SP_SETPCMARK and other SP_ values pos_T *match_pos, - linenr_T lnum_stop, /* stop at this line if not zero */ - long time_limit UNUSED) /* stop after this many msec */ + linenr_T lnum_stop, // stop at this line if not zero + long time_limit UNUSED) // stop after this many msec { char_u *save_cpo; char_u *pat, *pat2 = NULL, *pat3 = NULL; @@ -6268,17 +6266,17 @@ do_searchpair( proftime_T tm; #endif - /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ + // Make 'cpoptions' empty, the 'l' flag should not be used here. save_cpo = p_cpo; p_cpo = empty_option; #ifdef FEAT_RELTIME - /* Set the time limit, if there is one. */ + // Set the time limit, if there is one. profile_setlimit(time_limit, &tm); #endif - /* Make two search patterns: start/end (pat2, for in nested pairs) and - * start/middle/end (pat3, for the top pair). */ + // Make two search patterns: start/end (pat2, for in nested pairs) and + // start/middle/end (pat3, for the top pair). pat2 = alloc(STRLEN(spat) + STRLEN(epat) + 17); pat3 = alloc(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 25); if (pat2 == NULL || pat3 == NULL) @@ -6294,7 +6292,7 @@ do_searchpair( if (skip != NULL) { - /* Empty string means to not use the skip expression. */ + // Empty string means to not use the skip expression. if (skip->v_type == VAR_STRING || skip->v_type == VAR_FUNC) use_skip = skip->vval.v_string != NULL && *skip->vval.v_string != NUL; @@ -6317,16 +6315,16 @@ do_searchpair( n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L, options, RE_SEARCH, &sia); if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos))) - /* didn't find it or found the first match again: FAIL */ + // didn't find it or found the first match again: FAIL break; if (firstpos.lnum == 0) firstpos = pos; if (EQUAL_POS(pos, foundpos)) { - /* Found the same position again. Can happen with a pattern that - * has "\zs" at the end and searching backwards. Advance one - * character and try again. */ + // Found the same position again. Can happen with a pattern that + // has "\zs" at the end and searching backwards. Advance one + // character and try again. if (dir == BACKWARD) decl(&pos); else @@ -6334,10 +6332,10 @@ do_searchpair( } foundpos = pos; - /* clear the start flag to avoid getting stuck here */ + // clear the start flag to avoid getting stuck here options &= ~SEARCH_START; - /* If the skip pattern matches, ignore this match. */ + // If the skip pattern matches, ignore this match. if (use_skip) { save_pos = curwin->w_cursor; @@ -6347,7 +6345,7 @@ do_searchpair( curwin->w_cursor = save_pos; if (err) { - /* Evaluating {skip} caused an error, break here. */ + // Evaluating {skip} caused an error, break here. curwin->w_cursor = save_cursor; retval = -1; break; @@ -6358,22 +6356,22 @@ do_searchpair( if ((dir == BACKWARD && n == 3) || (dir == FORWARD && n == 2)) { - /* Found end when searching backwards or start when searching - * forward: nested pair. */ + // Found end when searching backwards or start when searching + // forward: nested pair. ++nest; - pat = pat2; /* nested, don't search for middle */ + pat = pat2; // nested, don't search for middle } else { - /* Found end when searching forward or start when searching - * backward: end of (nested) pair; or found middle in outer pair. */ + // Found end when searching forward or start when searching + // backward: end of (nested) pair; or found middle in outer pair. if (--nest == 1) - pat = pat3; /* outer level, search for middle */ + pat = pat3; // outer level, search for middle } if (nest == 0) { - /* Found the match: return matchcount or line number. */ + // Found the match: return matchcount or line number. if (flags & SP_RETCOUNT) ++retval; else @@ -6383,18 +6381,18 @@ do_searchpair( curwin->w_cursor = pos; if (!(flags & SP_REPEAT)) break; - nest = 1; /* search for next unmatched */ + nest = 1; // search for next unmatched } } if (match_pos != NULL) { - /* Store the match cursor position */ + // Store the match cursor position match_pos->lnum = curwin->w_cursor.lnum; match_pos->col = curwin->w_cursor.col + 1; } - /* If 'n' flag is used or search failed: restore cursor position. */ + // If 'n' flag is used or search failed: restore cursor position. if ((flags & SP_NOMOVE) || retval == 0) curwin->w_cursor = save_cursor; @@ -6404,7 +6402,7 @@ theend: if (p_cpo == empty_option) p_cpo = save_cpo; else - /* Darn, evaluating the {skip} expression changed the value. */ + // Darn, evaluating the {skip} expression changed the value. free_string_option(save_cpo); return retval; @@ -6600,7 +6598,7 @@ f_setpos(typval_T *argvars, typval_T *re pos.col = 0; if (name[0] == '.' && name[1] == NUL) { - /* set cursor; "fnum" is ignored */ + // set cursor; "fnum" is ignored curwin->w_cursor = pos; if (curswant >= 0) { @@ -6612,7 +6610,7 @@ f_setpos(typval_T *argvars, typval_T *re } else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) { - /* set mark */ + // set mark if (setmark_pos(name[1], &pos, fnum) == OK) rettv->vval.v_number = 0; } @@ -6641,10 +6639,10 @@ f_setreg(typval_T *argvars, typval_T *re append = FALSE; strregname = tv_get_string_chk(argvars); - rettv->vval.v_number = 1; /* FAIL is default */ + rettv->vval.v_number = 1; // FAIL is default if (strregname == NULL) - return; /* type error; errmsg already given */ + return; // type error; errmsg already given regname = *strregname; if (regname == 0 || regname == '@') regname = '"'; @@ -6653,20 +6651,20 @@ f_setreg(typval_T *argvars, typval_T *re { stropt = tv_get_string_chk(&argvars[2]); if (stropt == NULL) - return; /* type error */ + return; // type error for (; *stropt != NUL; ++stropt) switch (*stropt) { - case 'a': case 'A': /* append */ + case 'a': case 'A': // append append = TRUE; break; - case 'v': case 'c': /* character-wise selection */ + case 'v': case 'c': // character-wise selection yank_type = MCHAR; break; - case 'V': case 'l': /* line-wise selection */ + case 'V': case 'l': // line-wise selection yank_type = MLINE; break; - case 'b': case Ctrl_V: /* block-wise selection */ + case 'b': case Ctrl_V: // block-wise selection yank_type = MBLOCK; if (VIM_ISDIGIT(stropt[1])) { @@ -6689,11 +6687,11 @@ f_setreg(typval_T *argvars, typval_T *re listitem_T *li; int len; - /* If the list is NULL handle like an empty list. */ + // If the list is NULL handle like an empty list. len = ll == NULL ? 0 : ll->lv_len; - /* First half: use for pointers to result lines; second half: use for - * pointers to allocated copies. */ + // First half: use for pointers to result lines; second half: use for + // pointers to allocated copies. lstval = ALLOC_MULT(char_u *, (len + 1) * 2); if (lstval == NULL) return; @@ -6709,8 +6707,8 @@ f_setreg(typval_T *argvars, typval_T *re goto free_lstval; if (strval == buf) { - /* Need to make a copy, next tv_get_string_buf_chk() will - * overwrite the string. */ + // Need to make a copy, next tv_get_string_buf_chk() will + // overwrite the string. strval = vim_strsave(buf); if (strval == NULL) goto free_lstval; @@ -6808,7 +6806,7 @@ f_sha256(typval_T *argvars, typval_T *re sha256_bytes(p, (int)STRLEN(p), NULL, 0)); rettv->v_type = VAR_STRING; } -#endif /* FEAT_CRYPT */ +#endif // FEAT_CRYPT /* * "shellescape({string})" function @@ -6912,7 +6910,7 @@ f_spellbadword(typval_T *argvars UNUSED, #ifdef FEAT_SPELL if (argvars[0].v_type == VAR_UNKNOWN) { - /* Find the start and length of the badly spelled word. */ + // Find the start and length of the badly spelled word. len = spell_move_to(curwin, FORWARD, TRUE, TRUE, &attr); if (len != 0) { @@ -6927,7 +6925,7 @@ f_spellbadword(typval_T *argvars UNUSED, if (str != NULL) { - /* Check the argument for spelling. */ + // Check the argument for spelling. while (*str != NUL) { len = spell_check(curwin, str, &attr, &capcol, FALSE); @@ -7027,7 +7025,7 @@ f_split(typval_T *argvars, typval_T *ret int keepempty = FALSE; int typeerr = FALSE; - /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ + // Make 'cpoptions' empty, the 'l' flag should not be used here. save_cpo = p_cpo; p_cpo = (char_u *)""; @@ -7055,7 +7053,7 @@ f_split(typval_T *argvars, typval_T *ret while (*str != NUL || keepempty) { if (*str == NUL) - match = FALSE; /* empty item at the end */ + match = FALSE; // empty item at the end else match = vim_regexec_nl(®match, str, col); if (match) @@ -7294,7 +7292,7 @@ f_strftime(typval_T *argvars, typval_T * else seconds = (time_t)tv_get_number(&argvars[1]); curtime = vim_localtime(&seconds, &tmval); - /* MSVC returns NULL for an invalid value of seconds. */ + // MSVC returns NULL for an invalid value of seconds. if (curtime == NULL) rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)")); else @@ -7321,7 +7319,7 @@ f_strftime(typval_T *argvars, typval_T * else rettv->vval.v_string = vim_strsave(result_buf); - /* Release conversion descriptors */ + // Release conversion descriptors convert_setup(&conv, NULL, NULL); vim_free(enc); } @@ -7378,7 +7376,7 @@ f_stridx(typval_T *argvars, typval_T *re save_haystack = haystack = tv_get_string_buf_chk(&argvars[0], buf); rettv->vval.v_number = -1; if (needle == NULL || haystack == NULL) - return; /* type error; errmsg already given */ + return; // type error; errmsg already given if (argvars[2].v_type != VAR_UNKNOWN) { @@ -7408,7 +7406,7 @@ f_string(typval_T *argvars, typval_T *re rettv->v_type = VAR_STRING; rettv->vval.v_string = tv2string(&argvars[0], &tofree, numbuf, get_copyID()); - /* Make a copy if we have a value but it's not in allocated memory. */ + // Make a copy if we have a value but it's not in allocated memory. if (rettv->vval.v_string != NULL && tofree == NULL) rettv->vval.v_string = vim_strsave(rettv->vval.v_string); } @@ -7519,7 +7517,7 @@ f_strcharpart(typval_T *argvars, typval_ } } else - len = slen - nbyte; /* default: all bytes that are available. */ + len = slen - nbyte; // default: all bytes that are available. } /* @@ -7563,7 +7561,7 @@ f_strpart(typval_T *argvars, typval_T *r else if (argvars[2].v_type != VAR_UNKNOWN) len = (int)tv_get_number(&argvars[2]); else - len = slen - n; /* default len: all bytes that are available. */ + len = slen - n; // default len: all bytes that are available. /* * Only return the overlap between the specified part and the actual @@ -7637,22 +7635,22 @@ f_strridx(typval_T *argvars, typval_T *r rettv->vval.v_number = -1; if (needle == NULL || haystack == NULL) - return; /* type error; errmsg already given */ + return; // type error; errmsg already given haystack_len = (int)STRLEN(haystack); if (argvars[2].v_type != VAR_UNKNOWN) { - /* Third argument: upper limit for index */ + // Third argument: upper limit for index end_idx = (int)tv_get_number_chk(&argvars[2], NULL); if (end_idx < 0) - return; /* can never find a match */ + return; // can never find a match } else end_idx = haystack_len; if (*needle == NUL) { - /* Empty string matches past the end. */ + // Empty string matches past the end. lastmatch = haystack + end_idx; } else @@ -7786,8 +7784,8 @@ f_synID(typval_T *argvars UNUSED, typval int trans; int transerr = FALSE; - lnum = tv_get_lnum(argvars); /* -1 on type error */ - col = (linenr_T)tv_get_number(&argvars[1]) - 1; /* -1 on type error */ + lnum = tv_get_lnum(argvars); // -1 on type error + col = (linenr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error trans = (int)tv_get_number_chk(&argvars[2], &transerr); if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count @@ -7819,7 +7817,7 @@ f_synIDattr(typval_T *argvars UNUSED, ty mode = tv_get_string_buf(&argvars[2], modebuf); modec = TOLOWER_ASC(mode[0]); if (modec != 't' && modec != 'c' && modec != 'g') - modec = 0; /* replace invalid with current */ + modec = 0; // replace invalid with current } else { @@ -7837,48 +7835,48 @@ f_synIDattr(typval_T *argvars UNUSED, ty switch (TOLOWER_ASC(what[0])) { case 'b': - if (TOLOWER_ASC(what[1]) == 'g') /* bg[#] */ + if (TOLOWER_ASC(what[1]) == 'g') // bg[#] p = highlight_color(id, what, modec); - else /* bold */ + else // bold p = highlight_has_attr(id, HL_BOLD, modec); break; - case 'f': /* fg[#] or font */ + case 'f': // fg[#] or font p = highlight_color(id, what, modec); break; case 'i': - if (TOLOWER_ASC(what[1]) == 'n') /* inverse */ + if (TOLOWER_ASC(what[1]) == 'n') // inverse p = highlight_has_attr(id, HL_INVERSE, modec); - else /* italic */ + else // italic p = highlight_has_attr(id, HL_ITALIC, modec); break; - case 'n': /* name */ + case 'n': // name p = get_highlight_name_ext(NULL, id - 1, FALSE); break; - case 'r': /* reverse */ + case 'r': // reverse p = highlight_has_attr(id, HL_INVERSE, modec); break; case 's': - if (TOLOWER_ASC(what[1]) == 'p') /* sp[#] */ + if (TOLOWER_ASC(what[1]) == 'p') // sp[#] p = highlight_color(id, what, modec); - /* strikeout */ + // strikeout else if (TOLOWER_ASC(what[1]) == 't' && TOLOWER_ASC(what[2]) == 'r') p = highlight_has_attr(id, HL_STRIKETHROUGH, modec); - else /* standout */ + else // standout p = highlight_has_attr(id, HL_STANDOUT, modec); break; case 'u': if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c') - /* underline */ + // underline p = highlight_has_attr(id, HL_UNDERLINE, modec); else - /* undercurl */ + // undercurl p = highlight_has_attr(id, HL_UNDERCURL, modec); break; } @@ -7928,8 +7926,8 @@ f_synconcealed(typval_T *argvars UNUSED, rettv_list_set(rettv, NULL); #if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) - lnum = tv_get_lnum(argvars); /* -1 on type error */ - col = (colnr_T)tv_get_number(&argvars[1]) - 1; /* -1 on type error */ + lnum = tv_get_lnum(argvars); // -1 on type error + col = (colnr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error vim_memset(str, NUL, sizeof(str)); @@ -7942,7 +7940,7 @@ f_synconcealed(typval_T *argvars UNUSED, (void)syn_get_id(curwin, lnum, col, FALSE, NULL, FALSE); syntax_flags = get_syntax_info(&matchid); - /* get the conceal character */ + // get the conceal character if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3) { cchar = syn_get_sub_char(); @@ -7960,7 +7958,7 @@ f_synconcealed(typval_T *argvars UNUSED, list_append_number(rettv->vval.v_list, (syntax_flags & HL_CONCEAL) != 0); - /* -1 to auto-determine strlen */ + // -1 to auto-determine strlen list_append_string(rettv->vval.v_list, str, -1); list_append_number(rettv->vval.v_list, matchid); } @@ -7983,8 +7981,8 @@ f_synstack(typval_T *argvars UNUSED, typ rettv_list_set(rettv, NULL); #ifdef FEAT_SYN_HL - lnum = tv_get_lnum(argvars); /* -1 on type error */ - col = (colnr_T)tv_get_number(&argvars[1]) - 1; /* -1 on type error */ + lnum = tv_get_lnum(argvars); // -1 on type error + col = (colnr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) @@ -8151,15 +8149,15 @@ f_tr(typval_T *argvars, typval_T *rettv) fromstr = tv_get_string_buf_chk(&argvars[1], buf); tostr = tv_get_string_buf_chk(&argvars[2], buf2); - /* Default return value: empty string. */ + // Default return value: empty string. rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; if (fromstr == NULL || tostr == NULL) - return; /* type error; errmsg already given */ + return; // type error; errmsg already given ga_init2(&ga, (int)sizeof(char), 80); if (!has_mbyte) - /* not multi-byte: fromstr and tostr must be the same length */ + // not multi-byte: fromstr and tostr must be the same length if (STRLEN(fromstr) != STRLEN(tostr)) { error: @@ -8168,7 +8166,7 @@ error: return; } - /* fromstr and tostr have to contain the same number of chars */ + // fromstr and tostr have to contain the same number of chars while (*in_str != NUL) { if (has_mbyte) @@ -8192,7 +8190,7 @@ error: break; } } - if (*p == NUL) /* tostr is shorter than fromstr */ + if (*p == NUL) // tostr is shorter than fromstr goto error; break; } @@ -8201,9 +8199,9 @@ error: if (first && cpstr == in_str) { - /* Check that fromstr and tostr have the same number of - * (multi-byte) characters. Done only once when a character - * of in_str doesn't appear in fromstr. */ + // Check that fromstr and tostr have the same number of + // (multi-byte) characters. Done only once when a character + // of in_str doesn't appear in fromstr. first = FALSE; for (p = tostr; *p != NUL; p += tolen) { @@ -8222,7 +8220,7 @@ error: } else { - /* When not using multi-byte chars we can do it faster. */ + // When not using multi-byte chars we can do it faster. p = vim_strchr(fromstr, *in_str); if (p != NULL) ga_append(&ga, tostr[p - fromstr]); @@ -8232,7 +8230,7 @@ error: } } - /* add a terminating NUL */ + // add a terminating NUL (void)ga_grow(&ga, 1); ga_append(&ga, NUL); @@ -8316,7 +8314,7 @@ f_trunc(typval_T *argvars, typval_T *ret rettv->v_type = VAR_FLOAT; if (get_float_arg(argvars, &f) == OK) - /* trunc() is not in C90, use floor() or ceil() instead. */ + // trunc() is not in C90, use floor() or ceil() instead. rettv->vval.v_float = f > 0 ? floor(f) : ceil(f); else rettv->vval.v_float = 0.0; @@ -8392,7 +8390,7 @@ f_visualmode(typval_T *argvars, typval_T str[1] = NUL; rettv->vval.v_string = vim_strsave(str); - /* A non-zero number or non-empty string argument: reset mode. */ + // A non-zero number or non-empty string argument: reset mode. if (non_zero_arg(&argvars[0])) curbuf->b_visual_mode_eval = NUL; } @@ -8430,4 +8428,4 @@ f_xor(typval_T *argvars, typval_T *rettv ^ tv_get_number_chk(&argvars[1], NULL); } -#endif /* FEAT_EVAL */ +#endif // FEAT_EVAL