Merge pull request #18334 from dundargoc/refactor/remove-char_u

refactor: replace char_u variables and functions with char
This commit is contained in:
bfredl 2022-05-01 10:35:48 +02:00 committed by GitHub
commit d9dcfd0219
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 374 additions and 379 deletions

View File

@ -1113,7 +1113,7 @@ void nvim_buf_set_name(Buffer buffer, String name, Error *err)
// Using aucmd_*: autocommands will be executed by rename_buffer
aco_save_T aco;
aucmd_prepbuf(&aco, buf);
int ren_ret = rename_buffer((char_u *)name.data);
int ren_ret = rename_buffer(name.data);
aucmd_restbuf(&aco);
if (try_end(err)) {

View File

@ -4870,7 +4870,7 @@ void do_arg_all(int count, int forceit, int keep_tabs)
new_curwin = curwin;
new_curtab = curtab;
}
(void)do_ecmd(0, alist_name(&AARGLIST(alist)[i]), NULL, NULL, ECMD_ONE,
(void)do_ecmd(0, (char *)alist_name(&AARGLIST(alist)[i]), NULL, NULL, ECMD_ONE,
((buf_hide(curwin->w_buffer)
|| bufIsChanged(curwin->w_buffer))
? ECMD_HIDE : 0) + ECMD_OLDBUF,

File diff suppressed because it is too large Load Diff

View File

@ -565,8 +565,8 @@ void dialog_changed(buf_T *buf, bool checkall)
if (buf->b_fname != NULL
&& check_overwrite(&ea,
buf,
buf->b_fname,
buf->b_ffname,
(char *)buf->b_fname,
(char *)buf->b_ffname,
false) == OK) {
// didn't hit Cancel
(void)buf_write_all(buf, false);
@ -583,8 +583,8 @@ void dialog_changed(buf_T *buf, bool checkall)
set_bufref(&bufref, buf2);
if (buf2->b_fname != NULL
&& check_overwrite(&ea, buf2, buf2->b_fname,
buf2->b_ffname, false) == OK) {
&& check_overwrite(&ea, buf2, (char *)buf2->b_fname,
(char *)buf2->b_ffname, false) == OK) {
// didn't hit Cancel
(void)buf_write_all(buf2, false);
}
@ -1166,7 +1166,7 @@ void do_argfile(exarg_T *eap, int argn)
// Edit the file; always use the last known line number.
// When it fails (e.g. Abort for already edited file) restore the
// argument index.
if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
if (do_ecmd(0, (char *)alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
eap, ECMD_LAST,
(buf_hide(curwin->w_buffer) ? ECMD_HIDE : 0)
+ (eap->forceit ? ECMD_FORCEIT : 0), curwin) == FAIL) {

View File

@ -1232,7 +1232,7 @@ static void set_cmd_addr_type(exarg_T *eap, char_u *p)
}
// :wincmd range depends on the argument
if (eap->cmdidx == CMD_wincmd && p != NULL) {
get_wincmd_addr_type((char *)skipwhite((char_u *)p), eap);
get_wincmd_addr_type((char *)skipwhite(p), eap);
}
// :.cc in quickfix window uses line number
if ((eap->cmdidx == CMD_cc || eap->cmdidx == CMD_ll) && bt_quickfix(curbuf)) {
@ -2311,10 +2311,10 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
}
}
if (skip_only) {
p = (char *)skip_vimgrep_pat((char_u *)p, NULL, NULL);
p = skip_vimgrep_pat(p, NULL, NULL);
} else {
// NOTE: This puts a NUL after the pattern.
p = (char *)skip_vimgrep_pat((char_u *)p, (char_u **)&reg_pat, NULL);
p = skip_vimgrep_pat(p, &reg_pat, NULL);
}
if (p == NULL || *p == NUL) {
break;
@ -3492,7 +3492,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
case CMD_filter:
if (*arg != NUL) {
arg = (const char *)skip_vimgrep_pat((char_u *)arg, NULL, NULL);
arg = (const char *)skip_vimgrep_pat((char *)arg, NULL, NULL);
}
if (arg == NULL || *arg == NUL) {
xp->xp_context = EXPAND_NOTHING;
@ -4487,7 +4487,7 @@ static char *skip_grep_pat(exarg_T *eap)
|| eap->cmdidx == CMD_vimgrepadd
|| eap->cmdidx == CMD_lvimgrepadd
|| grep_internal(eap->cmdidx))) {
p = (char *)skip_vimgrep_pat((char_u *)p, NULL, NULL);
p = skip_vimgrep_pat(p, NULL, NULL);
if (p == NULL) {
p = (char *)eap->arg;
}
@ -7676,7 +7676,7 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
if (eap->cmdidx != CMD_balt && eap->cmdidx != CMD_badd) {
setpcmark();
}
if (do_ecmd(0, (eap->cmdidx == CMD_enew ? NULL : eap->arg),
if (do_ecmd(0, eap->cmdidx == CMD_enew ? NULL : (char *)eap->arg,
NULL, eap, eap->do_ecmd_lnum,
(buf_hide(curbuf) ? ECMD_HIDE : 0)
+ (eap->forceit ? ECMD_FORCEIT : 0)
@ -9758,7 +9758,7 @@ static void ex_folddo(exarg_T *eap)
}
}
global_exe(eap->arg); // Execute the command on the marked lines.
global_exe((char *)eap->arg); // Execute the command on the marked lines.
ml_clearmarked(); // clear rest of the marks
}

View File

@ -4932,8 +4932,8 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char_u **
if (xp->xp_context == EXPAND_HELP) {
/* With an empty argument we would get all the help tags, which is
* very slow. Get matches for "help" instead. */
if (find_help_tags(*pat == NUL ? (char_u *)"help" : pat,
num_file, file, false) == OK) {
if (find_help_tags(*pat == NUL ? "help" : (char *)pat,
num_file, (char ***)file, false) == OK) {
cleanup_help_tags(*num_file, *file);
return OK;
}

View File

@ -1748,8 +1748,8 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
// at the ATTENTION prompt close the window.
swap_exists_did_quit = false;
(void)do_ecmd(0, arg_idx < GARGCOUNT
? alist_name(&GARGLIST[arg_idx]) : NULL,
NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
? (char *)alist_name(&GARGLIST[arg_idx])
: NULL, NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
if (swap_exists_did_quit) {
// abort or quit selected
if (got_int || only_one_window()) {

View File

@ -4614,7 +4614,7 @@ static void nv_gotofile(cmdarg_T *cap)
(void)autowrite(curbuf, false);
}
setpcmark();
if (do_ecmd(0, ptr, NULL, NULL, ECMD_LAST,
if (do_ecmd(0, (char *)ptr, NULL, NULL, ECMD_LAST,
buf_hide(curbuf) ? ECMD_HIDE : 0, curwin) == OK
&& cap->nchar == 'F' && lnum >= 0) {
curwin->w_cursor.lnum = lnum;

View File

@ -746,7 +746,7 @@ char_u *get_cmd_output(char_u *cmd, char_u *infile, ShellOpts flags, size_t *ret
}
// Add the redirection stuff
char_u *command = make_filter_cmd(cmd, infile, tempname);
char_u *command = (char_u *)make_filter_cmd((char *)cmd, (char *)infile, (char *)tempname);
// Call the shell to execute the command (errors are ignored).
// Don't check timestamps here.

View File

@ -4394,7 +4394,7 @@ void ex_make(exarg_T *eap)
char *const cmd = make_get_fullcmd((char *)eap->arg, fname);
do_shell((char_u *)cmd, 0);
do_shell(cmd, 0);
incr_quickfix_busy();
@ -5423,7 +5423,7 @@ static int vgr_process_args(exarg_T *eap, vgr_args_T *args)
}
// Get the search pattern: either white-separated or enclosed in //
char *p = (char *)skip_vimgrep_pat(eap->arg, (char_u **)&args->spat, &args->flags);
char *p = skip_vimgrep_pat((char *)eap->arg, &args->spat, &args->flags);
if (p == NULL) {
emsg(_(e_invalpat));
return FAIL;
@ -7238,7 +7238,7 @@ void ex_helpgrep(exarg_T *eap)
incr_quickfix_busy();
// Check for a specified language
char *const lang = (char *)check_help_lang(eap->arg);
char *const lang = check_help_lang((char *)eap->arg);
regmatch_T regmatch = {
.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING),
.rm_ic = false,

View File

@ -5808,7 +5808,7 @@ search_line:
curwin->w_cursor.lnum = lnum;
check_cursor();
} else {
if (!GETFILE_SUCCESS(getfile(0, files[depth].name, NULL, true,
if (!GETFILE_SUCCESS(getfile(0, (char *)files[depth].name, NULL, true,
files[depth].lnum, false))) {
break; // failed to jump to file
}

View File

@ -2097,8 +2097,8 @@ parse_line:
STRCPY(p, tagp.tagname);
p[len] = '@';
STRCPY(p + len + 1, help_lang);
snprintf((char *)p + len + 1 + ML_EXTRA, 10, "%06d",
help_heuristic(tagp.tagname,
snprintf((char *)p + len + 1 + ML_EXTRA, STRLEN(p) + len + 1 + ML_EXTRA, "%06d",
help_heuristic((char *)tagp.tagname,
match_re ? matchoff : 0, !match_no_ic)
+ help_pri);
@ -2795,7 +2795,7 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
if (getfile_result == GETFILE_UNUSED) {
// Careful: getfile() may trigger autocommands and call jumpto_tag()
// recursively.
getfile_result = getfile(0, fname, NULL, true, (linenr_T)0, forceit);
getfile_result = getfile(0, (char *)fname, NULL, true, (linenr_T)0, forceit);
}
keep_help_flag = false;

View File

@ -489,7 +489,7 @@ wingotofile:
setpcmark();
if (win_split(0, 0) == OK) {
RESET_BINDING(curwin);
if (do_ecmd(0, ptr, NULL, NULL, ECMD_LASTL, ECMD_HIDE, NULL) == FAIL) {
if (do_ecmd(0, (char *)ptr, NULL, NULL, ECMD_LASTL, ECMD_HIDE, NULL) == FAIL) {
// Failed to open the file, close the window opened for it.
win_close(curwin, false, false);
goto_tabpage_win(oldtab, oldwin);