mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
refactor: replace char_u variables and functions with char
Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
@@ -200,12 +200,12 @@ static char *pexpand_cmds[] = {
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the profile command
|
||||
/// specific expansion.
|
||||
char_u *get_profile_name(expand_T *xp, int idx)
|
||||
char *get_profile_name(expand_T *xp, int idx)
|
||||
FUNC_ATTR_PURE
|
||||
{
|
||||
switch (pexpand_what) {
|
||||
case PEXP_SUBCMD:
|
||||
return (char_u *)pexpand_cmds[idx];
|
||||
return pexpand_cmds[idx];
|
||||
// case PEXP_FUNC: TODO
|
||||
default:
|
||||
return NULL;
|
||||
@@ -792,7 +792,7 @@ int buf_write_all(buf_T *buf, int forceit)
|
||||
int retval;
|
||||
buf_T *old_curbuf = curbuf;
|
||||
|
||||
retval = (buf_write(buf, buf->b_ffname, buf->b_fname,
|
||||
retval = (buf_write(buf, (char *)buf->b_ffname, (char *)buf->b_fname,
|
||||
(linenr_T)1, buf->b_ml.ml_line_count, NULL,
|
||||
false, forceit, true, false));
|
||||
if (curbuf != old_curbuf) {
|
||||
@@ -1571,12 +1571,12 @@ static void alist_add_list(int count, char **files, int after, bool will_edit)
|
||||
|
||||
// Function given to ExpandGeneric() to obtain the possible arguments of the
|
||||
// argedit and argdelete commands.
|
||||
char_u *get_arglist_name(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
char *get_arglist_name(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
{
|
||||
if (idx >= ARGCOUNT) {
|
||||
return NULL;
|
||||
}
|
||||
return alist_name(&ARGLIST[idx]);
|
||||
return (char *)alist_name(&ARGLIST[idx]);
|
||||
}
|
||||
|
||||
/// ":compiler[!] {name}"
|
||||
@@ -1766,7 +1766,7 @@ typedef struct {
|
||||
///
|
||||
/// @return pointer to allocated line, or NULL for end-of-file or
|
||||
/// some error.
|
||||
static char_u *get_str_line(int c, void *cookie, int indent, bool do_concat)
|
||||
static char *get_str_line(int c, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
GetStrLineCookie *p = cookie;
|
||||
if (STRLEN(p->buf) <= p->offset) {
|
||||
@@ -1818,16 +1818,16 @@ scriptitem_T *new_script_item(char *const name, scid_T *const sid_out)
|
||||
|
||||
static int source_using_linegetter(void *cookie, LineGetter fgetline, const char *traceback_name)
|
||||
{
|
||||
char *save_sourcing_name = (char *)sourcing_name;
|
||||
char *save_sourcing_name = sourcing_name;
|
||||
linenr_T save_sourcing_lnum = sourcing_lnum;
|
||||
char sourcing_name_buf[256];
|
||||
if (save_sourcing_name == NULL) {
|
||||
sourcing_name = (char_u *)traceback_name;
|
||||
sourcing_name = (char *)traceback_name;
|
||||
} else {
|
||||
snprintf((char *)sourcing_name_buf, sizeof(sourcing_name_buf),
|
||||
"%s called at %s:%" PRIdLINENR, traceback_name, save_sourcing_name,
|
||||
save_sourcing_lnum);
|
||||
sourcing_name = (char_u *)sourcing_name_buf; // -V507 reassigned below, before return.
|
||||
sourcing_name = sourcing_name_buf; // -V507 reassigned below, before return.
|
||||
}
|
||||
sourcing_lnum = 0;
|
||||
|
||||
@@ -1842,7 +1842,7 @@ static int source_using_linegetter(void *cookie, LineGetter fgetline, const char
|
||||
int retval = do_cmdline(NULL, fgetline, cookie,
|
||||
DOCMD_VERBOSE | DOCMD_NOWAIT | DOCMD_REPEAT);
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
sourcing_name = (char_u *)save_sourcing_name;
|
||||
sourcing_name = save_sourcing_name;
|
||||
current_sctx = save_current_sctx;
|
||||
restore_funccal();
|
||||
return retval;
|
||||
@@ -1935,7 +1935,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
}
|
||||
|
||||
// Apply SourceCmd autocommands, they should get the file and source it.
|
||||
if (has_autocmd(EVENT_SOURCECMD, (char_u *)fname_exp, NULL)
|
||||
if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL)
|
||||
&& apply_autocmds(EVENT_SOURCECMD, (char_u *)fname_exp, (char_u *)fname_exp,
|
||||
false, curbuf)) {
|
||||
retval = aborting() ? FAIL : OK;
|
||||
@@ -1953,7 +1953,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
if (cookie.fp == NULL && check_other) {
|
||||
// Try again, replacing file name ".vimrc" by "_vimrc" or vice versa,
|
||||
// and ".exrc" by "_exrc" or vice versa.
|
||||
p = (char *)path_tail((char_u *)fname_exp);
|
||||
p = path_tail(fname_exp);
|
||||
if ((*p == '.' || *p == '_')
|
||||
&& (STRICMP(p + 1, "nvimrc") == 0 || STRICMP(p + 1, "exrc") == 0)) {
|
||||
*p = (*p == '_') ? '.' : '_';
|
||||
@@ -2014,8 +2014,8 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
cookie.level = ex_nesting_level;
|
||||
|
||||
// Keep the sourcing name/lnum, for recursive calls.
|
||||
save_sourcing_name = (char *)sourcing_name;
|
||||
sourcing_name = (char_u *)fname_exp;
|
||||
save_sourcing_name = sourcing_name;
|
||||
sourcing_name = fname_exp;
|
||||
save_sourcing_lnum = sourcing_lnum;
|
||||
sourcing_lnum = 0;
|
||||
|
||||
@@ -2059,7 +2059,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
cookie.conv.vc_type = CONV_NONE; // no conversion
|
||||
|
||||
// Read the first line so we can check for a UTF-8 BOM.
|
||||
firstline = getsourceline(0, (void *)&cookie, 0, true);
|
||||
firstline = (uint8_t *)getsourceline(0, (void *)&cookie, 0, true);
|
||||
if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
|
||||
&& firstline[1] == 0xbb && firstline[2] == 0xbf) {
|
||||
// Found BOM; setup conversion, skip over BOM and recode the line.
|
||||
@@ -2104,7 +2104,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
if (got_int) {
|
||||
emsg(_(e_interr));
|
||||
}
|
||||
sourcing_name = (char_u *)save_sourcing_name;
|
||||
sourcing_name = save_sourcing_name;
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
if (p_verbose > 1) {
|
||||
verbose_enter();
|
||||
@@ -2302,7 +2302,7 @@ linenr_T get_sourced_lnum(LineGetter fgetline, void *cookie)
|
||||
///
|
||||
/// @return pointer to the line in allocated memory, or NULL for end-of-file or
|
||||
/// some error.
|
||||
char_u *getsourceline(int c, void *cookie, int indent, bool do_concat)
|
||||
char *getsourceline(int c, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
struct source_cookie *sp = (struct source_cookie *)cookie;
|
||||
char *line;
|
||||
@@ -2382,7 +2382,7 @@ char_u *getsourceline(int c, void *cookie, int indent, bool do_concat)
|
||||
sp->dbg_tick = debug_tick;
|
||||
}
|
||||
|
||||
return (char_u *)line;
|
||||
return line;
|
||||
}
|
||||
|
||||
static char *get_one_sourceline(struct source_cookie *sp)
|
||||
@@ -2942,36 +2942,36 @@ void free_locales(void)
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the possible arguments of the
|
||||
/// ":language" command.
|
||||
char_u *get_lang_arg(expand_T *xp, int idx)
|
||||
char *get_lang_arg(expand_T *xp, int idx)
|
||||
{
|
||||
if (idx == 0) {
|
||||
return (char_u *)"messages";
|
||||
return "messages";
|
||||
}
|
||||
if (idx == 1) {
|
||||
return (char_u *)"ctype";
|
||||
return "ctype";
|
||||
}
|
||||
if (idx == 2) {
|
||||
return (char_u *)"time";
|
||||
return "time";
|
||||
}
|
||||
if (idx == 3) {
|
||||
return (char_u *)"collate";
|
||||
return "collate";
|
||||
}
|
||||
|
||||
init_locales();
|
||||
if (locales == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return (char_u *)locales[idx - 4];
|
||||
return locales[idx - 4];
|
||||
}
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the available locales.
|
||||
char_u *get_locales(expand_T *xp, int idx)
|
||||
char *get_locales(expand_T *xp, int idx)
|
||||
{
|
||||
init_locales();
|
||||
if (locales == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return (char_u *)locales[idx];
|
||||
return locales[idx];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user