*: Partial string handling refactoring

Main points:

- Replace `char_u` with `char` in some cases.
- Remove `str[len] = NUL` hack in some cases when `str` may be considered
  `const`.
This commit is contained in:
ZyX
2016-07-29 21:41:45 +03:00
parent 2a50ff7e2f
commit efa2682e3b
32 changed files with 1289 additions and 1037 deletions

View File

@@ -1879,7 +1879,7 @@ getexmodeline (
vcol = indent;
while (indent >= 8) {
ga_append(&line_ga, TAB);
msg_puts((char_u *)" ");
msg_puts(" ");
indent -= 8;
}
while (indent-- > 0) {
@@ -2608,7 +2608,7 @@ static void redrawcmdprompt(void)
if (ccline.cmdfirstc != NUL)
msg_putchar(ccline.cmdfirstc);
if (ccline.cmdprompt != NULL) {
msg_puts_attr(ccline.cmdprompt, ccline.cmdattr);
msg_puts_attr((const char *)ccline.cmdprompt, ccline.cmdattr);
ccline.cmdindent = msg_col + (msg_row - cmdline_row) * Columns;
/* do the reverse of set_cmdspos() */
if (ccline.cmdfirstc != NUL)
@@ -3317,7 +3317,7 @@ static int showmatches(expand_T *xp, int wildmenu)
msg_outtrans_attr(files_found[k], hl_attr(HLF_D));
p = files_found[k] + STRLEN(files_found[k]) + 1;
msg_advance(maxlen + 1);
msg_puts(p);
msg_puts((const char *)p);
msg_advance(maxlen + 3);
msg_puts_long_attr(p + 2, hl_attr(HLF_D));
break;
@@ -3759,6 +3759,8 @@ static void cleanup_help_tags(int num_file, char_u **file)
}
}
typedef char_u *(*ExpandFunc)(expand_T *, int);
/*
* Do the expansion based on xp->xp_context and "pat".
*/
@@ -3898,7 +3900,7 @@ ExpandFromContext (
else {
static struct expgen {
int context;
char_u *((*func)(expand_T *, int));
ExpandFunc func;
int ic;
int escaped;
} tab[] =
@@ -3919,7 +3921,7 @@ ExpandFromContext (
{EXPAND_MENUNAMES, get_menu_names, FALSE, TRUE},
{EXPAND_SYNTAX, get_syntax_name, TRUE, TRUE},
{EXPAND_SYNTIME, get_syntime_arg, TRUE, TRUE},
{EXPAND_HIGHLIGHT, get_highlight_name, TRUE, TRUE},
{EXPAND_HIGHLIGHT, (ExpandFunc)get_highlight_name, TRUE, TRUE},
{EXPAND_EVENTS, get_event_name, TRUE, TRUE},
{EXPAND_AUGROUP, get_augroup_name, TRUE, TRUE},
{EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE},