mirror of
https://github.com/neovim/neovim.git
synced 2025-10-07 02:16:31 +00:00
refactor: replace char_u with char 23 (#21798)
Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
@@ -757,7 +757,7 @@ void ml_recover(bool checkext)
|
||||
directly = false;
|
||||
|
||||
// count the number of matching swap files
|
||||
len = recover_names((char_u *)fname, false, 0, NULL);
|
||||
len = recover_names(fname, false, 0, NULL);
|
||||
if (len == 0) { // no swap files found
|
||||
semsg(_("E305: No swap file found for %s"), fname);
|
||||
goto theend;
|
||||
@@ -767,7 +767,7 @@ void ml_recover(bool checkext)
|
||||
i = 1;
|
||||
} else { // several swap files found, choose
|
||||
// list the names of the swap files
|
||||
(void)recover_names((char_u *)fname, true, 0, NULL);
|
||||
(void)recover_names(fname, true, 0, NULL);
|
||||
msg_putchar('\n');
|
||||
msg_puts(_("Enter number of swap file to use (0 to quit): "));
|
||||
i = get_number(false, NULL);
|
||||
@@ -776,7 +776,7 @@ void ml_recover(bool checkext)
|
||||
}
|
||||
}
|
||||
// get the swap file name that will be used
|
||||
(void)recover_names((char_u *)fname, false, i, &fname_used);
|
||||
(void)recover_names(fname, false, i, &fname_used);
|
||||
}
|
||||
if (fname_used == NULL) {
|
||||
goto theend; // user chose invalid number.
|
||||
@@ -1201,24 +1201,24 @@ theend:
|
||||
/// @param list when true, list the swap file names
|
||||
/// @param nr when non-zero, return nr'th swap file name
|
||||
/// @param fname_out result when "nr" > 0
|
||||
int recover_names(char_u *fname, int list, int nr, char **fname_out)
|
||||
int recover_names(char *fname, int list, int nr, char **fname_out)
|
||||
{
|
||||
int num_names;
|
||||
char *(names[6]);
|
||||
char_u *tail;
|
||||
char *tail;
|
||||
char *p;
|
||||
int file_count = 0;
|
||||
char **files;
|
||||
char_u *fname_res = NULL;
|
||||
char *fname_res = NULL;
|
||||
#ifdef HAVE_READLINK
|
||||
char_u fname_buf[MAXPATHL];
|
||||
char fname_buf[MAXPATHL];
|
||||
#endif
|
||||
|
||||
if (fname != NULL) {
|
||||
#ifdef HAVE_READLINK
|
||||
// Expand symlink in the file name, because the swap file is created
|
||||
// with the actual file instead of with the symlink.
|
||||
if (resolve_symlink((char *)fname, (char *)fname_buf) == OK) {
|
||||
if (resolve_symlink(fname, fname_buf) == OK) {
|
||||
fname_res = fname_buf;
|
||||
} else
|
||||
#endif
|
||||
@@ -1250,7 +1250,7 @@ int recover_names(char_u *fname, int list, int nr, char **fname_out)
|
||||
names[2] = xstrdup(".sw?");
|
||||
num_names = 3;
|
||||
} else {
|
||||
num_names = recov_file_names(names, (char *)fname_res, true);
|
||||
num_names = recov_file_names(names, fname_res, true);
|
||||
}
|
||||
} else { // check directory dir_name
|
||||
if (fname == NULL) {
|
||||
@@ -1267,13 +1267,12 @@ int recover_names(char_u *fname, int list, int nr, char **fname_out)
|
||||
&& len > 1
|
||||
&& p[-1] == p[-2]) {
|
||||
// Ends with '//', Use Full path for swap name
|
||||
tail = (char_u *)make_percent_swname(dir_name,
|
||||
(char *)fname_res);
|
||||
tail = make_percent_swname(dir_name, fname_res);
|
||||
} else {
|
||||
tail = (char_u *)path_tail((char *)fname_res);
|
||||
tail = (char_u *)concat_fnames(dir_name, (char *)tail, true);
|
||||
tail = path_tail(fname_res);
|
||||
tail = concat_fnames(dir_name, tail, true);
|
||||
}
|
||||
num_names = recov_file_names(names, (char *)tail, false);
|
||||
num_names = recov_file_names(names, tail, false);
|
||||
xfree(tail);
|
||||
}
|
||||
}
|
||||
@@ -1290,11 +1289,11 @@ int recover_names(char_u *fname, int list, int nr, char **fname_out)
|
||||
// not able to execute the shell).
|
||||
// Try finding a swap file by simply adding ".swp" to the file name.
|
||||
if (*dirp == NUL && file_count + num_files == 0 && fname != NULL) {
|
||||
char_u *swapname = (char_u *)modname((char *)fname_res, ".swp", true);
|
||||
char *swapname = modname(fname_res, ".swp", true);
|
||||
if (swapname != NULL) {
|
||||
if (os_path_exists((char *)swapname)) {
|
||||
files = xmalloc(sizeof(char_u *));
|
||||
files[0] = (char *)swapname;
|
||||
if (os_path_exists(swapname)) {
|
||||
files = xmalloc(sizeof(char *));
|
||||
files[0] = swapname;
|
||||
swapname = NULL;
|
||||
num_files = 1;
|
||||
}
|
||||
@@ -1877,7 +1876,7 @@ int ml_append(linenr_T lnum, char *line, colnr_T len, bool newfile)
|
||||
/// @param line text of the new line
|
||||
/// @param len length of new line, including NUL, or 0
|
||||
/// @param newfile flag, see above
|
||||
int ml_append_buf(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, bool newfile)
|
||||
int ml_append_buf(buf_T *buf, linenr_T lnum, char *line, colnr_T len, bool newfile)
|
||||
FUNC_ATTR_NONNULL_ARG(1)
|
||||
{
|
||||
if (buf->b_ml.ml_mfp == NULL) {
|
||||
@@ -1887,7 +1886,7 @@ int ml_append_buf(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, bool new
|
||||
if (buf->b_ml.ml_line_lnum != 0) {
|
||||
ml_flush_line(buf);
|
||||
}
|
||||
return ml_append_int(buf, lnum, (char *)line, len, newfile, false);
|
||||
return ml_append_int(buf, lnum, line, len, newfile, false);
|
||||
}
|
||||
|
||||
/// @param lnum append after this line (can be 0)
|
||||
|
Reference in New Issue
Block a user