refactor: migrate comment style 2 #20080

This commit is contained in:
dundargoc 2022-09-06 16:23:00 +02:00 committed by GitHub
parent 84d1094958
commit 12afc344de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 196 additions and 214 deletions

View File

@ -789,8 +789,8 @@ struct file_buffer {
int b_ind_cpp_extern_c;
int b_ind_pragma;
linenr_T b_no_eol_lnum; /* non-zero lnum when last line of next binary
* write should not have an end-of-line */
linenr_T b_no_eol_lnum; // non-zero lnum when last line of next binary
// write should not have an end-of-line
int b_start_eol; // last line had eol when it was read
int b_start_ffc; // first char of 'ff' when edit started
@ -805,8 +805,8 @@ struct file_buffer {
// then set to indicate that a swap file may be opened later. It is reset
// if a swap file could not be opened.
bool b_may_swap;
bool b_did_warn; /* Set to true if user has been warned on first
change of a read-only file */
bool b_did_warn; // Set to true if user has been warned on first
// change of a read-only file
// Two special kinds of buffers:
// help buffer - used for help files, won't use a swap file.
@ -1237,8 +1237,7 @@ struct window_S {
// w_valid is a bitfield of flags, which indicate if specific values are
// valid or need to be recomputed.
int w_valid;
pos_T w_valid_cursor; /* last known position of w_cursor, used
to adjust w_valid */
pos_T w_valid_cursor; // last known position of w_cursor, used to adjust w_valid
colnr_T w_valid_leftcol; // last known w_leftcol
bool w_viewport_invalid;
@ -1383,8 +1382,7 @@ struct window_S {
int w_fraction;
int w_prev_fraction_row;
linenr_T w_nrwidth_line_count; /* line count when ml_nrwidth_width
* was computed. */
linenr_T w_nrwidth_line_count; // line count when ml_nrwidth_width was computed.
int w_nrwidth_width; // nr of chars to print line count.
qf_info_T *w_llist; // Location list for this window
@ -1407,4 +1405,4 @@ struct window_S {
#define CHANGEDTICK(buf) \
(=== Include buffer.h & use buf_(get|set|inc) _changedtick ===)
#endif // NVIM_BUFFER_DEFS_H
#endif // NVIM_BUFFER_DEFS_H

View File

@ -2330,8 +2330,8 @@ static void stop_insert(pos_T *end_insert_pos, int esc, int nomove)
if (gchar_cursor() != NUL) {
inc_cursor();
}
/* If the cursor is still at the same character, also keep
* the "coladd". */
// If the cursor is still at the same character, also keep
// the "coladd".
if (gchar_cursor() == NUL
&& curwin->w_cursor.lnum == tpos.lnum
&& curwin->w_cursor.col == tpos.col) {
@ -3165,8 +3165,8 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
if (keytyped == KEY_COMPLETE) {
char_u *n, *s;
/* Just completed a word, check if it starts with "look".
* search back for the start of a word. */
// Just completed a word, check if it starts with "look".
// search back for the start of a word.
line = (char_u *)get_cursor_line_ptr();
for (s = line + curwin->w_cursor.col; s > line; s = n) {
n = mb_prevptr(line, s);
@ -3198,8 +3198,8 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
}
}
if (match && try_match_word && !try_match) {
/* "0=word": Check if there are only blanks before the
* word. */
// "0=word": Check if there are only blanks before the
// word.
if (getwhitecols_curline() !=
(int)(curwin->w_cursor.col - (p - look))) {
match = false;

View File

@ -75,9 +75,8 @@ static char_u *ff_expand_buffer = NULL; // used for expanding filenames
typedef struct ff_stack {
struct ff_stack *ffs_prev;
/* the fix part (no wildcards) and the part containing the wildcards
* of the search path
*/
// the fix part (no wildcards) and the part containing the wildcards
// of the search path
char_u *ffs_fix_path;
char_u *ffs_wc_path;
@ -87,15 +86,13 @@ typedef struct ff_stack {
int ffs_filearray_size;
int ffs_filearray_cur; // needed for partly handled dirs
/* to store status of partly handled directories
* 0: we work on this directory for the first time
* 1: this directory was partly searched in an earlier step
*/
// to store status of partly handled directories
// 0: we work on this directory for the first time
// 1: this directory was partly searched in an earlier step
int ffs_stage;
/* How deep are we in the directory tree?
* Counts backward from value of level parameter to vim_findfile_init
*/
// How deep are we in the directory tree?
// Counts backward from value of level parameter to vim_findfile_init
int ffs_level;
// Did we already expand '**' to an empty string?
@ -242,9 +239,8 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
ff_stack_T *sptr;
ff_search_ctx_T *search_ctx;
/* If a search context is given by the caller, reuse it, else allocate a
* new one.
*/
// If a search context is given by the caller, reuse it, else allocate a
// new one.
if (search_ctx_arg != NULL) {
search_ctx = search_ctx_arg;
} else {
@ -260,9 +256,9 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
if (free_visited == true) {
vim_findfile_free_visited(search_ctx);
} else {
/* Reuse old visited lists. Get the visited list for the given
* filename. If no list for the current filename exists, creates a new
* one. */
// Reuse old visited lists. Get the visited list for the given
// filename. If no list for the current filename exists, creates a new
// one.
search_ctx->ffsc_visited_list = ff_get_visited_list((char_u *)filename,
&search_ctx->ffsc_visited_lists_list);
if (search_ctx->ffsc_visited_list == NULL) {
@ -279,8 +275,8 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
ff_expand_buffer = xmalloc(MAXPATHL);
}
/* Store information on starting dir now if path is relative.
* If path is absolute, we do that later. */
// Store information on starting dir now if path is relative.
// If path is absolute, we do that later.
if (path[0] == '.'
&& (vim_ispathsep(path[1]) || path[1] == NUL)
&& (!tagfile || vim_strchr(p_cpo, CPO_DOTTAG) == NULL)
@ -321,8 +317,8 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
search_ctx->ffsc_start_dir = (char *)vim_strsave(ff_expand_buffer);
#ifdef BACKSLASH_IN_FILENAME
/* A path that starts with "/dir" is relative to the drive, not to the
* directory (but not for "//machine/dir"). Only use the drive name. */
// A path that starts with "/dir" is relative to the drive, not to the
// directory (but not for "//machine/dir"). Only use the drive name.
if ((*path == '/' || *path == '\\')
&& path[1] != path[0]
&& search_ctx->ffsc_start_dir[1] == ':') {
@ -362,9 +358,7 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
search_ctx->ffsc_stopdirs_v[dircount - 1] = xstrnsave(helper, (size_t)(walker - helper));
walker++;
} else {
/* this might be "", which means ascent till top
* of directory tree.
*/
// this might be "", which means ascent till top of directory tree.
search_ctx->ffsc_stopdirs_v[dircount - 1] = xstrdup(helper);
}
@ -375,10 +369,9 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
search_ctx->ffsc_level = level;
/* split into:
* -fix path
* -wildcard_stuff (might be NULL)
*/
// split into:
// -fix path
// -wildcard_stuff (might be NULL)
wc_part = vim_strchr(path, '*');
if (wc_part != NULL) {
int64_t llevel;
@ -433,9 +426,8 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
}
if (search_ctx->ffsc_start_dir == NULL) {
/* store the fix part as startdir.
* This is needed if the parameter path is fully qualified.
*/
// store the fix part as startdir.
// This is needed if the parameter path is fully qualified.
search_ctx->ffsc_start_dir = xstrdup(search_ctx->ffsc_fix_path);
search_ctx->ffsc_fix_path[0] = NUL;
}
@ -513,8 +505,8 @@ char_u *vim_findfile_stopdir(char_u *buf)
while (*r_ptr != NUL && *r_ptr != ';') {
if (r_ptr[0] == '\\' && r_ptr[1] == ';') {
/* Overwrite the escape char,
* use STRLEN(r_ptr) to move the trailing '\0'. */
// Overwrite the escape char,
// use STRLEN(r_ptr) to move the trailing '\0'.
STRMOVE(r_ptr, r_ptr + 1);
r_ptr++;
}
@ -653,9 +645,7 @@ char_u *vim_findfile(void *search_ctx_arg)
if (stackp->ffs_filearray == NULL) {
char *dirptrs[2];
/* we use filepath to build the path expand_wildcards() should
* expand.
*/
// we use filepath to build the path expand_wildcards() should expand.
dirptrs[0] = (char *)file_path;
dirptrs[1] = NULL;
@ -742,9 +732,9 @@ char_u *vim_findfile(void *search_ctx_arg)
stackp->ffs_filearray[0] = xstrdup(dirptrs[0]);
stackp->ffs_filearray_size = 1;
} else {
/* Add EW_NOTWILD because the expanded path may contain
* wildcard characters that are to be taken literally.
* This is a bit of a hack. */
// Add EW_NOTWILD because the expanded path may contain
// wildcard characters that are to be taken literally.
// This is a bit of a hack.
expand_wildcards((dirptrs[1] == NULL) ? 1 : 2, dirptrs,
&stackp->ffs_filearray_size,
&stackp->ffs_filearray,
@ -886,9 +876,8 @@ char_u *vim_findfile(void *search_ctx_arg)
ff_free_stack_element(stackp);
}
/* If we reached this, we didn't find anything downwards.
* Let's check if we should do an upward search.
*/
// If we reached this, we didn't find anything downwards.
// Let's check if we should do an upward search.
if (search_ctx->ffsc_start_dir
&& search_ctx->ffsc_stopdirs_v != NULL && !got_int) {
ff_stack_T *sptr;
@ -1157,8 +1146,8 @@ static ff_stack_T *ff_create_stack_element(char_u *fix_part, char_u *wc_part, in
/// Push a dir on the directory stack.
static void ff_push(ff_search_ctx_T *search_ctx, ff_stack_T *stack_ptr)
{
/* check for NULL pointer, not to return an error to the user, but
* to prevent a crash */
// check for NULL pointer, not to return an error to the user, but
// to prevent a crash
if (stack_ptr != NULL) {
stack_ptr->ffs_prev = search_ctx->ffsc_stack_ptr;
search_ctx->ffsc_stack_ptr = stack_ptr;
@ -1251,10 +1240,9 @@ static int ff_path_in_stoplist(char_u *path, int path_len, char_u **stopdirs_v)
for (i = 0; stopdirs_v[i] != NULL; i++) {
if ((int)STRLEN(stopdirs_v[i]) > path_len) {
/* match for parent directory. So '/home' also matches
* '/home/rks'. Check for PATHSEP in stopdirs_v[i], else
* '/home/r' would also match '/home/rks'
*/
// match for parent directory. So '/home' also matches
// '/home/rks'. Check for PATHSEP in stopdirs_v[i], else
// '/home/r' would also match '/home/rks'
if (FNAMENCMP(stopdirs_v[i], path, path_len) == 0
&& vim_ispathsep(stopdirs_v[i][path_len])) {
return true;
@ -1407,8 +1395,8 @@ char_u *find_file_in_path_option(char_u *ptr, size_t len, int options, int first
goto theend;
}
/* When FNAME_REL flag given first use the directory of the file.
* Otherwise or when this fails use the current directory. */
// When FNAME_REL flag given first use the directory of the file.
// Otherwise or when this fails use the current directory.
for (int run = 1; run <= 2; run++) {
size_t l = STRLEN(ff_file_to_find);
if (run == 1
@ -1424,8 +1412,7 @@ char_u *find_file_in_path_option(char_u *ptr, size_t len, int options, int first
run = 2;
}
/* When the file doesn't exist, try adding parts of
* 'suffixesadd'. */
// When the file doesn't exist, try adding parts of 'suffixesadd'.
buf = (char *)suffixes;
for (;;) {
if (
@ -1467,8 +1454,7 @@ char_u *find_file_in_path_option(char_u *ptr, size_t len, int options, int first
char_u *r_ptr;
if (dir == NULL || *dir == NUL) {
/* We searched all paths of the option, now we can
* free the search context. */
// We searched all paths of the option, now we can free the search context.
vim_findfile_cleanup(fdip_search_ctx);
fdip_search_ctx = NULL;
break;

View File

@ -82,12 +82,12 @@
#define FIO_UCSBOM 0x4000 // check for BOM at start of file
#define FIO_ALL (-1) // allow all formats
/* When converting, a read() or write() may leave some bytes to be converted
* for the next call. The value is guessed... */
// When converting, a read() or write() may leave some bytes to be converted
// for the next call. The value is guessed...
#define CONV_RESTLEN 30
/* We have to guess how much a sequence of bytes may expand when converting
* with iconv() to be able to allocate a buffer. */
// We have to guess how much a sequence of bytes may expand when converting
// with iconv() to be able to allocate a buffer.
#define ICONV_MULT 8
// Structure to pass arguments from buf_write() to buf_write_bytes().
@ -2091,8 +2091,8 @@ static void check_marks_read(void)
shada_read_marks();
}
/* Always set b_marks_read; needed when 'shada' is changed to include
* the ' parameter after opening a buffer. */
// Always set b_marks_read; needed when 'shada' is changed to include
// the ' parameter after opening a buffer.
curbuf->b_marks_read = true;
}
@ -2177,8 +2177,8 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
int wb_flags = 0;
#endif
#ifdef HAVE_ACL
vim_acl_T acl = NULL; /* ACL copied from original file to
backup or new file */
vim_acl_T acl = NULL; // ACL copied from original file to
// backup or new file
#endif
int write_undo_file = false;
context_sha256_T sha_ctx;
@ -2190,8 +2190,8 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
return FAIL;
}
if (buf->b_ml.ml_mfp == NULL) {
/* This can happen during startup when there is a stray "w" in the
* vimrc file. */
// This can happen during startup when there is a stray "w" in the
// vimrc file.
emsg(_(e_emptybuf));
return FAIL;
}
@ -2217,8 +2217,8 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
write_info.bw_iconv_fd = (iconv_t)-1;
#endif
/* After writing a file changedtick changes but we don't want to display
* the line. */
// After writing a file changedtick changes but we don't want to display
// the line.
ex_no_reprint = true;
// If there is no file name yet, use the one for the written file.
@ -2318,9 +2318,9 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
sfname, sfname, false, curbuf, eap);
if (did_cmd) {
if (was_changed && !curbufIsChanged()) {
/* Written everything correctly and BufWriteCmd has reset
* 'modified': Correct the undo information so that an
* undo now sets 'modified'. */
// Written everything correctly and BufWriteCmd has reset
// 'modified': Correct the undo information so that an
// undo now sets 'modified'.
u_unchanged(curbuf);
u_update_save_nr(curbuf);
}
@ -2371,14 +2371,14 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
if (nofile_err
|| aborting()) {
/* An aborting error, interrupt or exception in the
* autocommands. */
// An aborting error, interrupt or exception in the
// autocommands.
return FAIL;
}
if (did_cmd) {
if (buf == NULL) {
/* The buffer was deleted. We assume it was written
* (can't retry anyway). */
// The buffer was deleted. We assume it was written
// (can't retry anyway).
return OK;
}
if (overwriting) {
@ -2488,8 +2488,8 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
SET_ERRMSG_NUM("E503", _("is not a file or writable device"));
goto fail;
}
/* It's a device of some kind (or a fifo) which we can write to
* but for which we can't make a backup. */
// It's a device of some kind (or a fifo) which we can write to
// but for which we can't make a backup.
device = true;
newfile = true;
perm = -1;
@ -2616,8 +2616,8 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
backup_copy = true;
}
#endif
/* Close the file before removing it, on MS-Windows we
* can't delete an open file. */
// Close the file before removing it, on MS-Windows we
// can't delete an open file.
close(fd);
os_remove((char *)IObuff);
}
@ -3433,8 +3433,8 @@ restore_backup:
set_keep_msg(msg_trunc_attr((char *)IObuff, false, 0), 0);
}
/* When written everything correctly: reset 'modified'. Unless not
* writing to the original file and '+' is not in 'cpoptions'. */
// When written everything correctly: reset 'modified'. Unless not
// writing to the original file and '+' is not in 'cpoptions'.
if (reset_changed && whole && !append
&& !write_info.bw_conv_error
&& (overwriting || vim_strchr(p_cpo, CPO_PLUS) != NULL)) {
@ -3815,9 +3815,9 @@ static int buf_write_bytes(struct bw_info *ip)
if (wlen == 0 && ip->bw_restlen != 0) {
int l;
/* Use remainder of previous call. Append the start of
* buf[] to get a full sequence. Might still be too
* short! */
// Use remainder of previous call. Append the start of
// buf[] to get a full sequence. Might still be too
// short!
l = CONV_RESTLEN - ip->bw_restlen;
if (l > len) {
l = len;
@ -3825,9 +3825,9 @@ static int buf_write_bytes(struct bw_info *ip)
memmove(ip->bw_rest + ip->bw_restlen, buf, (size_t)l);
n = utf_ptr2len_len(ip->bw_rest, ip->bw_restlen + l);
if (n > ip->bw_restlen + len) {
/* We have an incomplete byte sequence at the end to
* be written. We can't convert it without the
* remaining bytes. Keep them for the next call. */
// We have an incomplete byte sequence at the end to
// be written. We can't convert it without the
// remaining bytes. Keep them for the next call.
if (ip->bw_restlen + len > CONV_RESTLEN) {
return FAIL;
}
@ -3851,9 +3851,9 @@ static int buf_write_bytes(struct bw_info *ip)
} else {
n = utf_ptr2len_len(buf + wlen, len - wlen);
if (n > len - wlen) {
/* We have an incomplete byte sequence at the end to
* be written. We can't convert it without the
* remaining bytes. Keep them for the next call. */
// We have an incomplete byte sequence at the end to
// be written. We can't convert it without the
// remaining bytes. Keep them for the next call.
if (len - wlen > CONV_RESTLEN) {
return FAIL;
}
@ -3896,9 +3896,9 @@ static int buf_write_bytes(struct bw_info *ip)
if (ip->bw_restlen > 0) {
char *fp;
/* Need to concatenate the remainder of the previous call and
* the bytes of the current call. Use the end of the
* conversion buffer for this. */
// Need to concatenate the remainder of the previous call and
// the bytes of the current call. Use the end of the
// conversion buffer for this.
fromlen = (size_t)len + (size_t)ip->bw_restlen;
fp = (char *)ip->bw_conv_buf + ip->bw_conv_buflen - fromlen;
memmove(fp, ip->bw_rest, (size_t)ip->bw_restlen);
@ -3918,9 +3918,8 @@ static int buf_write_bytes(struct bw_info *ip)
// output the initial shift state sequence
(void)iconv(ip->bw_iconv_fd, NULL, NULL, &to, &tolen);
/* There is a bug in iconv() on Linux (which appears to be
* wide-spread) which sets "to" to NULL and messes up "tolen".
*/
// There is a bug in iconv() on Linux (which appears to be
// wide-spread) which sets "to" to NULL and messes up "tolen".
if (to == NULL) {
to = (char *)ip->bw_conv_buf;
tolen = save_len;
@ -3984,8 +3983,8 @@ static bool ucs2bytes(unsigned c, char_u **pp, int flags) FUNC_ATTR_NONNULL_ALL
} else if (flags & (FIO_UCS2 | FIO_UTF16)) {
if (c >= 0x10000) {
if (flags & FIO_UTF16) {
/* Make two words, ten bits of the character in each. First
* word is 0xd800 - 0xdbff, second one 0xdc00 - 0xdfff */
// Make two words, ten bits of the character in each. First
// word is 0xd800 - 0xdbff, second one 0xdc00 - 0xdfff
c -= 0x10000;
if (c >= 0x100000) {
error = true;

View File

@ -176,8 +176,8 @@ struct prt_ps_font_S {
char *(ps_fontname[4]);
};
/* Structures to map user named encoding and mapping to PS equivalents for
* building CID font name */
// Structures to map user named encoding and mapping to PS equivalents for
// building CID font name
struct prt_ps_encoding_S {
char *encoding;
char *cmap_encoding;
@ -235,8 +235,8 @@ struct prt_dsc_line_S {
int len;
};
/* Static buffer to read initial comments in a resource file, some can have a
* couple of KB of comments! */
// Static buffer to read initial comments in a resource file, some can have a
// couple of KB of comments!
#define PRT_FILE_BUFFER_LEN (2048)
struct prt_resfile_buffer_S {
char_u buffer[PRT_FILE_BUFFER_LEN];
@ -1162,16 +1162,15 @@ static struct prt_ps_mbfont_S prt_ps_mbfonts[] =
}
};
/* The PS prolog file version number has to match - if the prolog file is
* updated, increment the number in the file and here. Version checking was
* added as of VIM 6.2.
* The CID prolog file version number behaves as per PS prolog.
* Table of VIM and prolog versions:
*
* VIM Prolog CIDProlog
* 6.2 1.3
* 7.0 1.4 1.0
*/
// The PS prolog file version number has to match - if the prolog file is
// updated, increment the number in the file and here. Version checking was
// added as of VIM 6.2.
// The CID prolog file version number behaves as per PS prolog.
// Table of VIM and prolog versions:
//
// VIM Prolog CIDProlog
// 6.2 1.3
// 7.0 1.4 1.0
#define PRT_PROLOG_VERSION ((char_u *)"1.4")
#define PRT_CID_PROLOG_VERSION ((char_u *)"1.0")
@ -1182,8 +1181,8 @@ static struct prt_ps_mbfont_S prt_ps_mbfonts[] =
#define PRT_RESOURCE_ENCODING "Encoding"
#define PRT_RESOURCE_CMAP "CMap"
/* Data for table based DSC comment recognition, easy to extend if VIM needs to
* read more comments. */
// Data for table based DSC comment recognition, easy to extend if VIM needs to
// read more comments.
#define PRT_DSC_MISC_TYPE (-1)
#define PRT_DSC_TITLE_TYPE (1)
#define PRT_DSC_VERSION_TYPE (2)
@ -1573,8 +1572,9 @@ static int prt_resfile_skip_ws(int offset)
return -1;
}
/* prt_next_dsc() - returns detail on next DSC comment line found. Returns true
* if a DSC comment is found, else false */
/// Returns detail on next DSC comment line found.
///
/// @return true if a DSC comment is found, else false
static bool prt_next_dsc(struct prt_dsc_line_S *p_dsc_line)
FUNC_ATTR_NONNULL_ALL
{

View File

@ -86,4 +86,4 @@ typedef struct xfilemark {
#define INIT_XFMARK { INIT_FMARK, NULL }
#endif // NVIM_MARK_DEFS_H
#endif // NVIM_MARK_DEFS_H

View File

@ -1161,7 +1161,7 @@ theend:
}
mf_close(mfp, false); // will also xfree(mfp->mf_fname)
}
if (buf != NULL) { //may be NULL if swap file not found.
if (buf != NULL) { // may be NULL if swap file not found.
xfree(buf->b_ml.ml_stack);
xfree(buf);
}

View File

@ -69,4 +69,4 @@ typedef struct memline {
int ml_usedchunks;
} memline_T;
#endif // NVIM_MEMLINE_DEFS_H
#endif // NVIM_MEMLINE_DEFS_H

View File

@ -681,9 +681,9 @@ void op_reindent(oparg_T *oap, Indenter how)
curwin->w_cursor.lnum = start_lnum;
beginline(BL_SOL | BL_FIX);
/* Mark changed lines so that they will be redrawn. When Visual
* highlighting was present, need to continue until the last line. When
* there is no change still need to remove the Visual highlighting. */
// Mark changed lines so that they will be redrawn. When Visual
// highlighting was present, need to continue until the last line. When
// there is no change still need to remove the Visual highlighting.
if (last_changed != 0) {
changed_lines(first_changed, 0,
oap->is_VIsual ? start_lnum + (linenr_T)oap->line_count :
@ -748,12 +748,12 @@ char_u *get_expr_line(void)
return NULL;
}
/* Make a copy of the expression, because evaluating it may cause it to be
* changed. */
// Make a copy of the expression, because evaluating it may cause it to be
// changed.
expr_copy = vim_strsave(expr_line);
/* When we are invoked recursively limit the evaluation to 10 levels.
* Then return the string as-is. */
// When we are invoked recursively limit the evaluation to 10 levels.
// Then return the string as-is.
if (nested >= 10) {
return expr_copy;
}
@ -1431,8 +1431,8 @@ bool cmdline_paste_reg(int regname, bool literally_arg, bool remcr)
cmdline_paste_str((char_u *)"\r", literally);
}
/* Check for CTRL-C, in case someone tries to paste a few thousand
* lines and gets bored. */
// Check for CTRL-C, in case someone tries to paste a few thousand
// lines and gets bored.
os_breakcheck();
if (got_int) {
return FAIL;
@ -2677,8 +2677,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
if (virtual_op) {
getvcol(curwin, &oap->start, &cs, NULL, &ce);
if (ce != cs && oap->start.coladd > 0) {
/* Part of a tab selected -- but don't
* double-count it. */
// Part of a tab selected -- but don't double-count it.
bd.startspaces = (ce - cs + 1)
- oap->start.coladd;
startcol++;
@ -3043,9 +3042,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
if (insert_string != NULL) {
y_type = kMTCharWise;
if (regname == '=') {
/* For the = register we need to split the string at NL
* characters.
* Loop twice: count the number of lines and save them. */
// For the = register we need to split the string at NL
// characters.
// Loop twice: count the number of lines and save them.
for (;;) {
y_size = 0;
ptr = insert_string;
@ -3285,9 +3284,9 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
delcount = 1;
bd.textcol -= utf_head_off(oldp, oldp + bd.textcol);
if (oldp[bd.textcol] != TAB) {
/* Only a Tab can be split into spaces. Other
* characters will have to be moved to after the
* block, causing misalignment. */
// Only a Tab can be split into spaces. Other
// characters will have to be moved to after the
// block, causing misalignment.
delcount = 0;
bd.endspaces = 0;
}

View File

@ -990,4 +990,4 @@ typedef struct {
uint64_t channel_id; /// Only used when script_id is SID_API_CLIENT.
} LastSet;
#endif // NVIM_OPTION_DEFS_H
#endif // NVIM_OPTION_DEFS_H

View File

@ -625,8 +625,8 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff,
char_u *e = NULL;
const char_u *path_end = path;
while (*path_end != NUL) {
/* May ignore a wildcard that has a backslash before it; it will
* be removed by rem_backslash() or file_pat_to_reg_pat() below. */
// May ignore a wildcard that has a backslash before it; it will
// be removed by rem_backslash() or file_pat_to_reg_pat() below.
if (path_end >= path + wildoff && rem_backslash((char *)path_end)) {
*p++ = *path_end++;
} else if (vim_ispathsep_nocolon(*path_end)) {
@ -651,8 +651,8 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff,
*e = NUL;
// Now we have one wildcard component between "s" and "e".
/* Remove backslashes between "wildoff" and the start of the wildcard
* component. */
// Remove backslashes between "wildoff" and the start of the wildcard
// component.
for (p = buf + wildoff; p < s; p++) {
if (rem_backslash((char *)p)) {
STRMOVE(p, p + 1);
@ -698,8 +698,8 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff,
return 0;
}
/* If "**" is by itself, this is the first time we encounter it and more
* is following then find matches without any directory. */
// If "**" is by itself, this is the first time we encounter it and more
// is following then find matches without any directory.
if (!didstar && stardepth < 100 && starstar && e - s == 2
&& *path_end == '/') {
STRCPY(s, path_end + 1);
@ -728,9 +728,9 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff,
len = STRLEN(buf);
if (starstar && stardepth < 100) {
/* For "**" in the pattern first go deeper in the tree to
* find matches. */
STRCPY(buf + len, "/**");
// For "**" in the pattern first go deeper in the tree to
// find matches.
STRCPY(buf + len, "/**"); // NOLINT
STRCPY(buf + len + 3, path_end);
stardepth++;
(void)do_path_expand(gap, buf, len + 1, flags, true);
@ -835,9 +835,9 @@ static void expand_path_option(char_u *curdir, garray_T *gap)
copy_option_part((char **)&path_option, (char *)buf, MAXPATHL, " ,");
if (buf[0] == '.' && (buf[1] == NUL || vim_ispathsep(buf[1]))) {
/* Relative to current buffer:
* "/path/file" + "." -> "/path/"
* "/path/file" + "./subdir" -> "/path/subdir" */
// Relative to current buffer:
// "/path/file" + "." -> "/path/"
// "/path/file" + "./subdir" -> "/path/subdir"
if (curbuf->b_ffname == NULL) {
continue;
}
@ -1028,8 +1028,8 @@ static void uniquefy_paths(garray_T *gap, char_u *pattern)
continue;
}
/* If the {filename} is not unique, change it to ./{filename}.
* Else reduce it to {filename} */
// If the {filename} is not unique, change it to ./{filename}.
// Else reduce it to {filename}
short_name = path_shorten_fname(path, curdir);
if (short_name == NULL) {
short_name = path;
@ -1278,8 +1278,8 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i
&& (vim_ispathsep(p[1])
|| (p[1] == '.'
&& vim_ispathsep(p[2]))))) {
/* :find completion where 'path' is used.
* Recursiveness is OK here. */
// :find completion where 'path' is used.
// Recursiveness is OK here.
recursive = false;
add_pat = expand_in_path(&ga, p, flags);
recursive = true;
@ -1295,8 +1295,8 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i
if (add_pat == -1 || (add_pat == 0 && (flags & EW_NOTFOUND))) {
char_u *t = (char_u *)backslash_halve_save((char *)p);
/* When EW_NOTFOUND is used, always add files and dirs. Makes
* "vim c:/" work. */
// When EW_NOTFOUND is used, always add files and dirs. Makes
// "vim c:/" work.
if (flags & EW_NOTFOUND) {
addfile(&ga, t, flags | EW_DIR | EW_FILE);
} else {
@ -1505,8 +1505,8 @@ void simplify_filename(char_u *filename)
start = p; // remember start after "c:/" or "/" or "///"
do {
/* At this point "p" is pointing to the char following a single "/"
* or "p" is at the "start" of the (absolute or relative) path name. */
// At this point "p" is pointing to the char following a single "/"
// or "p" is at the "start" of the (absolute or relative) path name.
if (vim_ispathsep(*p)) {
STRMOVE(p, p + 1); // remove duplicate "/"
} else if (p[0] == '.'
@ -1514,10 +1514,10 @@ void simplify_filename(char_u *filename)
if (p == start && relative) {
p += 1 + (p[1] != NUL); // keep single "." or leading "./"
} else {
/* Strip "./" or ".///". If we are at the end of the file name
* and there is no trailing path separator, either strip "/." if
* we are after "start", or strip "." if we are at the beginning
* of an absolute path name . */
// Strip "./" or ".///". If we are at the end of the file name
// and there is no trailing path separator, either strip "/." if
// we are after "start", or strip "." if we are at the beginning
// of an absolute path name.
tail = p + 1;
if (p[1] != NUL) {
while (vim_ispathsep(*tail)) {
@ -1542,9 +1542,9 @@ void simplify_filename(char_u *filename)
// Don't strip for an erroneous file name.
if (!stripping_disabled) {
/* If the preceding component does not exist in the file
* system, we strip it. On Unix, we don't accept a symbolic
* link that refers to a non-existent file. */
// If the preceding component does not exist in the file
// system, we strip it. On Unix, we don't accept a symbolic
// link that refers to a non-existent file.
saved_char = p[-1];
p[-1] = NUL;
FileInfo file_info;
@ -1560,16 +1560,16 @@ void simplify_filename(char_u *filename)
}
if (!do_strip) {
/* If the component exists in the file system, check
* that stripping it won't change the meaning of the
* file name. First get information about the
* unstripped file name. This may fail if the component
* to strip is not a searchable directory (but a regular
* file, for instance), since the trailing "/.." cannot
* be applied then. We don't strip it then since we
* don't want to replace an erroneous file name by
* a valid one, and we disable stripping of later
* components. */
// If the component exists in the file system, check
// that stripping it won't change the meaning of the
// file name. First get information about the
// unstripped file name. This may fail if the component
// to strip is not a searchable directory (but a regular
// file, for instance), since the trailing "/.." cannot
// be applied then. We don't strip it then since we
// don't want to replace an erroneous file name by
// a valid one, and we disable stripping of later
// components.
saved_char = *tail;
*tail = NUL;
if (os_fileinfo((char *)filename, &file_info)) {
@ -1579,13 +1579,13 @@ void simplify_filename(char_u *filename)
}
*tail = saved_char;
if (do_strip) {
/* The check for the unstripped file name
* above works also for a symbolic link pointing to
* a searchable directory. But then the parent of
* the directory pointed to by the link must be the
* same as the stripped file name. (The latter
* exists in the file system since it is the
* component's parent directory.) */
// The check for the unstripped file name
// above works also for a symbolic link pointing to
// a searchable directory. But then the parent of
// the directory pointed to by the link must be the
// same as the stripped file name. (The latter
// exists in the file system since it is the
// component's parent directory.)
FileInfo new_file_info;
if (p == start && relative) {
os_fileinfo(".", &new_file_info);
@ -1598,26 +1598,26 @@ void simplify_filename(char_u *filename)
if (!os_fileinfo_id_equal(&file_info, &new_file_info)) {
do_strip = false;
/* We don't disable stripping of later
* components since the unstripped path name is
* still valid. */
// We don't disable stripping of later
// components since the unstripped path name is
// still valid.
}
}
}
}
if (!do_strip) {
/* Skip the ".." or "../" and reset the counter for the
* components that might be stripped later on. */
// Skip the ".." or "../" and reset the counter for the
// components that might be stripped later on.
p = tail;
components = 0;
} else {
/* Strip previous component. If the result would get empty
* and there is no trailing path separator, leave a single
* "." instead. If we are at the end of the file name and
* there is no trailing path separator and a preceding
* component is left after stripping, strip its trailing
* path separator as well. */
// Strip previous component. If the result would get empty
// and there is no trailing path separator, leave a single
// "." instead. If we are at the end of the file name and
// there is no trailing path separator and a preceding
// component is left after stripping, strip its trailing
// path separator as well.
if (p == start && relative && tail[-1] == '.') {
*p++ = '.';
*p = NUL;
@ -1699,8 +1699,8 @@ char *find_file_name_in_path(char *ptr, size_t len, int options, long count, cha
ptr[len] = c;
}
/* Repeat finding the file "count" times. This matters when it
* appears several times in the path. */
// Repeat finding the file "count" times. This matters when it
// appears several times in the path.
while (file_name != NULL && --count > 0) {
xfree(file_name);
file_name =

View File

@ -51,4 +51,4 @@ typedef enum {
SIGN_TEXT,
} SignType;
#endif // NVIM_SIGN_DEFS_H
#endif // NVIM_SIGN_DEFS_H

View File

@ -1994,7 +1994,7 @@ static void spell_print_tree(wordnode_T *root)
}
}
#endif // SPELL_PRINTTREE
#endif // SPELL_PRINTTREE
// Reads the affix file "fname".
// Returns an afffile_T, NULL for complete failure.

View File

@ -180,10 +180,10 @@ char_u *vim_strsave_shellescape(const char_u *string, bool do_special, bool do_n
int csh_like;
bool fish_like;
/* Only csh and similar shells expand '!' within single quotes. For sh and
* the like we must not put a backslash before it, it will be taken
* literally. If do_special is set the '!' will be escaped twice.
* Csh also needs to have "\n" escaped twice when do_special is set. */
// Only csh and similar shells expand '!' within single quotes. For sh and
// the like we must not put a backslash before it, it will be taken
// literally. If do_special is set the '!' will be escaped twice.
// Csh also needs to have "\n" escaped twice when do_special is set.
csh_like = csh_like_shell();
// Fish shell uses '\' as an escape character within single quotes, so '\'

View File

@ -2048,7 +2048,7 @@ static int get_maximum_wincount(frame_T *fr, int height)
}
/// Make all windows the same height.
///'next_curwin' will soon be the current window, make sure it has enough rows.
/// 'next_curwin' will soon be the current window, make sure it has enough rows.
///
/// @param next_curwin pointer to current window to be or NULL
/// @param current do only frame with current window
@ -5524,7 +5524,7 @@ static void frame_setheight(frame_T *curfrp, int height)
}
frame_setheight(curfrp->fr_parent, height
+ frame_minheight(curfrp->fr_parent, NOWIN) - (int)p_wmh - 1);
//NOTREACHED
// NOTREACHED
}
// Compute the number of lines we will take from others frames (can be