aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/memline.c
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-12-28 13:42:24 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-12-30 12:45:38 +0100
commitc89292fcb7f2ebf06efb7c1d00c28f34c6f68fec (patch)
treeb1257a572495337ca936c47839bb08aa45528c84 /src/nvim/memline.c
parentd634cd5b0bc3ac6bdf285432f74a1c10f12b6031 (diff)
downloadrneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.tar.gz
rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.tar.bz2
rneovim-c89292fcb7f2ebf06efb7c1d00c28f34c6f68fec.zip
refactor: follow style guide
Diffstat (limited to 'src/nvim/memline.c')
-rw-r--r--src/nvim/memline.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 8f6b78d2d5..220e16ad99 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -328,7 +328,7 @@ int ml_open(buf_T *buf)
b0p->b0_dirty = buf->b_changed ? B0_DIRTY : 0;
b0p->b0_flags = (char)(get_fileformat(buf) + 1);
set_b0_fname(b0p, buf);
- (void)os_get_username(b0p->b0_uname, B0_UNAME_SIZE);
+ os_get_username(b0p->b0_uname, B0_UNAME_SIZE);
b0p->b0_uname[B0_UNAME_SIZE - 1] = NUL;
os_get_hostname(b0p->b0_hname, B0_HNAME_SIZE);
b0p->b0_hname[B0_HNAME_SIZE - 1] = NUL;
@@ -342,7 +342,7 @@ int ml_open(buf_T *buf)
// is created.
mf_put(mfp, hp, true, false);
if (!buf->b_help && !buf->b_spell) {
- (void)mf_sync(mfp, 0);
+ mf_sync(mfp, 0);
}
// Fill in root pointer block and write page 1.
@@ -448,7 +448,7 @@ void ml_setname(buf_T *buf)
emsg(_("E301: Oops, lost the swap file!!!"));
return;
}
- (void)os_set_cloexec(mfp->mf_fd);
+ os_set_cloexec(mfp->mf_fd);
}
if (!success) {
emsg(_("E302: Could not rename swap file"));
@@ -483,7 +483,7 @@ void ml_open_file(buf_T *buf)
if (buf->b_spell) {
char *fname = vim_tempname();
if (fname != NULL) {
- (void)mf_open_file(mfp, fname); // consumes fname!
+ mf_open_file(mfp, fname); // consumes fname!
}
buf->b_may_swap = false;
return;
@@ -527,8 +527,8 @@ void ml_open_file(buf_T *buf)
if (*p_dir != NUL && mfp->mf_fname == NULL) {
need_wait_return = true; // call wait_return() later
no_wait_return++;
- (void)semsg(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
- buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
+ semsg(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
+ buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
no_wait_return--;
}
@@ -792,7 +792,7 @@ void ml_recover(bool checkext)
i = 1;
} else { // several swapfiles found, choose
// list the names of the swapfiles
- (void)recover_names(fname, true, NULL, 0, NULL);
+ recover_names(fname, true, NULL, 0, NULL);
msg_putchar('\n');
msg_puts(_("Enter number of swap file to use (0 to quit): "));
i = get_number(false, NULL);
@@ -801,7 +801,7 @@ void ml_recover(bool checkext)
}
}
// get the swapfile name that will be used
- (void)recover_names(fname, false, NULL, i, &fname_used);
+ recover_names(fname, false, NULL, i, &fname_used);
}
if (fname_used == NULL) {
goto theend; // user chose invalid number.
@@ -1289,7 +1289,7 @@ int recover_names(char *fname, bool do_list, list_T *ret_list, int nr, char **fn
// Isolate a directory name from *dirp and put it in dir_name (we know
// it is large enough, so use 31000 for length).
// Advance dirp to next directory name.
- (void)copy_option_part(&dirp, dir_name, 31000, ",");
+ copy_option_part(&dirp, dir_name, 31000, ",");
if (dir_name[0] == '.' && dir_name[1] == NUL) { // check current dir
if (fname == NULL) {
@@ -1400,7 +1400,7 @@ int recover_names(char *fname, bool do_list, list_T *ret_list, int nr, char **fn
msg_puts(". ");
msg_puts(path_tail(files[i]));
msg_putchar('\n');
- (void)swapfile_info(files[i]);
+ swapfile_info(files[i]);
}
} else {
msg_puts(_(" -- none --\n"));
@@ -1639,7 +1639,7 @@ static bool swapfile_unchanged(char *fname)
return ret;
}
-static int recov_file_names(char **names, char *path, int prepend_dot)
+static int recov_file_names(char **names, char *path, bool prepend_dot)
FUNC_ATTR_NONNULL_ALL
{
int num_names = 0;
@@ -1688,7 +1688,7 @@ void ml_sync_all(int check_file, int check_char, bool do_fsync)
}
ml_flush_line(buf); // flush buffered line
// flush locked block
- (void)ml_find_line(buf, 0, ML_FLUSH);
+ ml_find_line(buf, 0, ML_FLUSH);
if (bufIsChanged(buf) && check_file && mf_need_trans(buf->b_ml.ml_mfp)
&& buf->b_ffname != NULL) {
// If the original file does not exist anymore or has been changed
@@ -1704,8 +1704,8 @@ void ml_sync_all(int check_file, int check_char, bool do_fsync)
}
}
if (buf->b_ml.ml_mfp->mf_dirty == MF_DIRTY_YES) {
- (void)mf_sync(buf->b_ml.ml_mfp, (check_char ? MFS_STOP : 0)
- | (do_fsync && bufIsChanged(buf) ? MFS_FLUSH : 0));
+ mf_sync(buf->b_ml.ml_mfp, (check_char ? MFS_STOP : 0)
+ | (do_fsync && bufIsChanged(buf) ? MFS_FLUSH : 0));
if (check_char && os_char_avail()) { // character available now
break;
}
@@ -1721,7 +1721,7 @@ void ml_sync_all(int check_file, int check_char, bool do_fsync)
/// changed or deleted.
///
/// @param message if true, the success of preserving is reported.
-void ml_preserve(buf_T *buf, int message, bool do_fsync)
+void ml_preserve(buf_T *buf, bool message, bool do_fsync)
{
memfile_T *mfp = buf->b_ml.ml_mfp;
int got_int_save = got_int;
@@ -1738,7 +1738,7 @@ void ml_preserve(buf_T *buf, int message, bool do_fsync)
got_int = false;
ml_flush_line(buf); // flush buffered line
- (void)ml_find_line(buf, 0, ML_FLUSH); // flush locked block
+ ml_find_line(buf, 0, ML_FLUSH); // flush locked block
int status = mf_sync(mfp, MFS_ALL | (do_fsync ? MFS_FLUSH : 0));
// stack is invalid after mf_sync(.., MFS_ALL)
@@ -1765,7 +1765,7 @@ void ml_preserve(buf_T *buf, int message, bool do_fsync)
CHECK(buf->b_ml.ml_locked_low != lnum, "low != lnum");
lnum = buf->b_ml.ml_locked_high + 1;
}
- (void)ml_find_line(buf, 0, ML_FLUSH); // flush locked block
+ ml_find_line(buf, 0, ML_FLUSH); // flush locked block
// sync the updated pointer blocks
if (mf_sync(mfp, MFS_ALL | (do_fsync ? MFS_FLUSH : 0)) == FAIL) {
status = FAIL;
@@ -1986,7 +1986,8 @@ int ml_append_buf(buf_T *buf, linenr_T lnum, char *line, colnr_T len, bool newfi
/// @param len length of line, including NUL, or 0
/// @param newfile flag, see above
/// @param mark mark the new line
-static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, bool newfile, int mark)
+static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, bool newfile,
+ bool mark)
{
// lnum out of range
if (lnum > buf->b_ml.ml_line_count || buf->b_ml.ml_mfp == NULL) {
@@ -2239,7 +2240,7 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, boo
// pointer blocks is done below
int lineadd = buf->b_ml.ml_locked_lineadd;
buf->b_ml.ml_locked_lineadd = 0;
- (void)ml_find_line(buf, 0, ML_FLUSH); // flush data block
+ ml_find_line(buf, 0, ML_FLUSH); // flush data block
// update pointer blocks for the new data block
for (stack_idx = buf->b_ml.ml_stack_top - 1; stack_idx >= 0; stack_idx--) {
@@ -2286,8 +2287,7 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char *line, colnr_T len, boo
// fix line count for rest of blocks in the stack
ml_lineadd(buf, lineadd);
// fix stack itself
- buf->b_ml.ml_stack[buf->b_ml.ml_stack_top].ip_high +=
- lineadd;
+ buf->b_ml.ml_stack[buf->b_ml.ml_stack_top].ip_high += lineadd;
(buf->b_ml.ml_stack_top)++;
}
@@ -2785,9 +2785,9 @@ static void ml_flush_line(buf_T *buf)
// that has only one line.
// Don't forget to copy the mark!
// How about handling errors???
- (void)ml_append_int(buf, lnum, new_line, new_len, false,
- (int)(dp->db_index[idx] & DB_MARKED));
- (void)ml_delete_int(buf, lnum, false);
+ ml_append_int(buf, lnum, new_line, new_len, false,
+ (int)(dp->db_index[idx] & DB_MARKED));
+ ml_delete_int(buf, lnum, false);
}
}
xfree(new_line);
@@ -3205,7 +3205,7 @@ static void attention_message(buf_T *buf, char *fname)
assert(buf->b_fname != NULL);
no_wait_return++;
- (void)emsg(_("E325: ATTENTION"));
+ emsg(_("E325: ATTENTION"));
msg_puts(_("\nFound a swap file by the name \""));
msg_home_replace(fname);
msg_puts("\"\n");
@@ -3308,7 +3308,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
// First allocate some memory to put the directory name in.
const size_t dir_len = strlen(*dirp) + 1;
char *dir_name = xmalloc(dir_len);
- (void)copy_option_part(dirp, dir_name, dir_len, ",");
+ copy_option_part(dirp, dir_name, dir_len, ",");
// We try different swapfile names until we find one that does not exist yet.
char *fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name);