aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfredl <bjorn.linse@gmail.com>2022-07-31 15:55:01 +0200
committerGitHub <noreply@github.com>2022-07-31 15:55:01 +0200
commit68ec497d52bc8e93e12c74099ee9826b9469c3be (patch)
tree7baab4d6c3644125835ffa24ae0948ce4327d393
parent86110ec93303a80ea14561d3976214ca27f0be63 (diff)
parent824a729628950d72834b98faf28d18b7a94eefb2 (diff)
downloadrneovim-68ec497d52bc8e93e12c74099ee9826b9469c3be.tar.gz
rneovim-68ec497d52bc8e93e12c74099ee9826b9469c3be.tar.bz2
rneovim-68ec497d52bc8e93e12c74099ee9826b9469c3be.zip
Merge pull request #19437 from dundargoc/refactor/char_u-to-char
refactor: replace char_u with char
-rw-r--r--src/nvim/change.c103
-rw-r--r--src/nvim/charset.c10
-rw-r--r--src/nvim/diff.c8
-rw-r--r--src/nvim/digraph.c12
-rw-r--r--src/nvim/eval/funcs.c12
-rw-r--r--src/nvim/ex_cmds.c28
-rw-r--r--src/nvim/ex_cmds2.c10
-rw-r--r--src/nvim/ex_docmd.c30
-rw-r--r--src/nvim/ex_getln.c147
-rw-r--r--src/nvim/file_search.c40
-rw-r--r--src/nvim/fileio.c16
-rw-r--r--src/nvim/garray.c2
-rw-r--r--src/nvim/hardcopy.c2
-rw-r--r--src/nvim/insexpand.c86
-rw-r--r--src/nvim/lua/executor.c2
-rw-r--r--src/nvim/mapping.c18
-rw-r--r--src/nvim/memline.c34
-rw-r--r--src/nvim/menu.c2
-rw-r--r--src/nvim/ops.c10
-rw-r--r--src/nvim/option.c23
-rw-r--r--src/nvim/os/shell.c28
-rw-r--r--src/nvim/path.c43
-rw-r--r--src/nvim/quickfix.c11
-rw-r--r--src/nvim/regexp.c66
-rw-r--r--src/nvim/regexp_bt.c4
-rw-r--r--src/nvim/regexp_nfa.c21
-rw-r--r--src/nvim/runtime.c55
-rw-r--r--src/nvim/screen.c19
-rw-r--r--src/nvim/spell.c2
-rw-r--r--src/nvim/spellfile.c34
-rw-r--r--src/nvim/strings.c2
-rw-r--r--src/nvim/syntax.c12
-rw-r--r--src/nvim/tag.c52
-rw-r--r--src/nvim/undo.c2
-rw-r--r--src/nvim/window.c4
35 files changed, 454 insertions, 496 deletions
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 22975d75d9..c063ece907 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -967,10 +967,10 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
int extra_len = 0; // length of p_extra string
int lead_len; // length of comment leader
int comment_start = 0; // start index of the comment leader
- char_u *lead_flags; // position in 'comments' for comment leader
- char_u *leader = NULL; // copy of comment leader
+ char *lead_flags; // position in 'comments' for comment leader
+ char *leader = NULL; // copy of comment leader
char_u *allocated = NULL; // allocated memory
- char_u *p;
+ char *p;
char_u saved_char = NUL; // init for GCC
pos_T *pos;
bool do_si = may_do_si();
@@ -1008,9 +1008,9 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// autoindent etc) a bit later.
replace_push(NUL); // Call twice because BS over NL expects it
replace_push(NUL);
- p = saved_line + curwin->w_cursor.col;
+ p = (char *)saved_line + curwin->w_cursor.col;
while (*p != NUL) {
- p += replace_push_mb(p);
+ p += replace_push_mb((char_u *)p);
}
saved_line[curwin->w_cursor.col] = NUL;
}
@@ -1018,8 +1018,8 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if ((State & MODE_INSERT) && (State & VREPLACE_FLAG) == 0) {
p_extra = saved_line + curwin->w_cursor.col;
if (do_si) { // need first char after new line break
- p = (char_u *)skipwhite((char *)p_extra);
- first_char = *p;
+ p = skipwhite((char *)p_extra);
+ first_char = (unsigned char)(*p);
}
extra_len = (int)STRLEN(p_extra);
saved_char = *p_extra;
@@ -1055,12 +1055,12 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// "if (condition) {"
if (!trunc_line && do_si && *saved_line != NUL
&& (p_extra == NULL || first_char != '{')) {
- char_u *ptr;
+ char *ptr;
old_cursor = curwin->w_cursor;
- ptr = saved_line;
+ ptr = (char *)saved_line;
if (flags & OPENLINE_DO_COM) {
- lead_len = get_leader_len((char *)ptr, NULL, false, true);
+ lead_len = get_leader_len(ptr, NULL, false, true);
} else {
lead_len = 0;
}
@@ -1068,12 +1068,12 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Skip preprocessor directives, unless they are recognised as comments.
if (lead_len == 0 && ptr[0] == '#') {
while (ptr[0] == '#' && curwin->w_cursor.lnum > 1) {
- ptr = ml_get(--curwin->w_cursor.lnum);
+ ptr = (char *)ml_get(--curwin->w_cursor.lnum);
}
newindent = get_indent();
}
if (flags & OPENLINE_DO_COM) {
- lead_len = get_leader_len((char *)ptr, NULL, false, true);
+ lead_len = get_leader_len(ptr, NULL, false, true);
} else {
lead_len = 0;
}
@@ -1084,7 +1084,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// */
// #define IN_THE_WAY
// This should line up here;
- p = (char_u *)skipwhite((char *)ptr);
+ p = skipwhite(ptr);
if (p[0] == '/' && p[1] == '*') {
p++;
}
@@ -1108,7 +1108,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
while (p > ptr && ascii_iswhite(*p)) {
p--;
}
- char_u last_char = *p;
+ char last_char = *p;
// find the character just before the '{' or ';'
if (last_char == '{' || last_char == ';') {
@@ -1130,7 +1130,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if ((pos = findmatch(NULL, '(')) != NULL) {
curwin->w_cursor.lnum = pos->lnum;
newindent = get_indent();
- ptr = get_cursor_line_ptr();
+ ptr = (char *)get_cursor_line_ptr();
}
}
// If last character is '{' do indent, without
@@ -1142,7 +1142,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Don't do this if the previous line ended in ';' or
// '}'.
} else if (last_char != ';' && last_char != '}'
- && cin_is_cinword(ptr)) {
+ && cin_is_cinword((char_u *)ptr)) {
did_si = true;
}
}
@@ -1159,7 +1159,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
} else {
was_backslashed = false;
}
- ptr = ml_get(++curwin->w_cursor.lnum);
+ ptr = (char *)ml_get(++curwin->w_cursor.lnum);
}
if (was_backslashed) {
newindent = 0; // Got to end of file
@@ -1167,7 +1167,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
newindent = get_indent();
}
}
- p = (char_u *)skipwhite((char *)ptr);
+ p = skipwhite(ptr);
if (*p == '}') { // if line starts with '}': do indent
did_si = true;
} else { // can delete indent when '{' typed
@@ -1192,14 +1192,13 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// This may then be inserted in front of the new line.
end_comment_pending = NUL;
if (flags & OPENLINE_DO_COM) {
- lead_len = get_leader_len((char *)saved_line, (char **)&lead_flags, dir == BACKWARD, true);
+ lead_len = get_leader_len((char *)saved_line, &lead_flags, dir == BACKWARD, true);
if (lead_len == 0 && curbuf->b_p_cin && do_cindent && dir == FORWARD
&& (!has_format_option(FO_NO_OPEN_COMS) || (flags & OPENLINE_FORMAT))) {
// Check for a line comment after code.
comment_start = check_linecomment(saved_line);
if (comment_start != MAXCOL) {
- lead_len = get_leader_len((char *)saved_line + comment_start,
- (char **)&lead_flags, false, true);
+ lead_len = get_leader_len((char *)saved_line + comment_start, &lead_flags, false, true);
if (lead_len != 0) {
lead_len += comment_start;
if (did_do_comment != NULL) {
@@ -1212,11 +1211,11 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
lead_len = 0;
}
if (lead_len > 0) {
- char_u *lead_repl = NULL; // replaces comment leader
+ char *lead_repl = NULL; // replaces comment leader
int lead_repl_len = 0; // length of *lead_repl
char_u lead_middle[COM_MAX_LEN]; // middle-comment string
char_u lead_end[COM_MAX_LEN]; // end-comment string
- char_u *comment_end = NULL; // where lead_end has been found
+ char_u *comment_end = NULL; // where lead_end has been found
int extra_space = false; // append extra space
int current_flag;
int require_blank = false; // requires blank after middle
@@ -1230,7 +1229,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
continue;
}
if (*p == COM_START || *p == COM_MIDDLE) {
- current_flag = *p;
+ current_flag = (unsigned char)(*p);
if (*p == COM_START) {
// Doing "O" on a start of comment does not insert leader.
if (dir == BACKWARD) {
@@ -1239,7 +1238,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
// find start of middle part
- (void)copy_option_part((char **)&p, (char *)lead_middle, COM_MAX_LEN, ",");
+ (void)copy_option_part(&p, (char *)lead_middle, COM_MAX_LEN, ",");
require_blank = false;
}
@@ -1250,7 +1249,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
p++;
}
- (void)copy_option_part((char **)&p, (char *)lead_middle, COM_MAX_LEN, ",");
+ (void)copy_option_part(&p, (char *)lead_middle, COM_MAX_LEN, ",");
while (*p && p[-1] != ':') { // find end of end flags
// Check whether we allow automatic ending of comments
@@ -1259,7 +1258,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
p++;
}
- size_t n = copy_option_part((char **)&p, (char *)lead_end, COM_MAX_LEN, ",");
+ size_t n = copy_option_part(&p, (char *)lead_end, COM_MAX_LEN, ",");
if (end_comment_pending == -1) { // we can set it now
end_comment_pending = lead_end[n - 1];
@@ -1268,9 +1267,9 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// If the end of the comment is in the same line, don't use
// the comment leader.
if (dir == FORWARD) {
- for (p = saved_line + lead_len; *p; p++) {
+ for (p = (char *)saved_line + lead_len; *p; p++) {
if (STRNCMP(p, lead_end, n) == 0) {
- comment_end = p;
+ comment_end = (char_u *)p;
lead_len = 0;
break;
}
@@ -1280,7 +1279,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Doing "o" on a start of comment inserts the middle leader.
if (lead_len > 0) {
if (current_flag == COM_START) {
- lead_repl = lead_middle;
+ lead_repl = (char *)lead_middle;
lead_repl_len = (int)STRLEN(lead_middle);
}
@@ -1310,10 +1309,10 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Doing "O" on the end of a comment inserts the middle leader.
// Find the string for the middle leader, searching backwards.
- while (p > curbuf->b_p_com && *p != ',') {
+ while (p > (char *)curbuf->b_p_com && *p != ',') {
p--;
}
- for (lead_repl = p; lead_repl > curbuf->b_p_com
+ for (lead_repl = p; lead_repl > (char *)curbuf->b_p_com
&& lead_repl[-1] != ':'; lead_repl--) {}
lead_repl_len = (int)(p - lead_repl);
@@ -1322,7 +1321,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
extra_space = true;
// Check whether we allow automatic ending of comments
- for (p2 = p; *p2 && *p2 != ':'; p2++) {
+ for (p2 = (char_u *)p; *p2 && *p2 != ':'; p2++) {
if (*p2 == COM_AUTO_END) {
end_comment_pending = -1; // means we want to set it
}
@@ -1342,7 +1341,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (dir == BACKWARD) {
lead_len = 0;
} else {
- lead_repl = (char_u *)"";
+ lead_repl = "";
lead_repl_len = 0;
}
break;
@@ -1358,7 +1357,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
+ 1;
assert(bytes >= 0);
leader = xmalloc((size_t)bytes);
- allocated = leader; // remember to free it later
+ allocated = (char_u *)leader; // remember to free it later
STRLCPY(leader, saved_line, lead_len + 1);
@@ -1376,9 +1375,9 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
for (p = lead_flags; *p != NUL && *p != ':';) {
if (*p == COM_RIGHT || *p == COM_LEFT) {
- c = *p++;
+ c = (unsigned char)(*p++);
} else if (ascii_isdigit(*p) || *p == '-') {
- off = getdigits_int((char **)&p, true, 0);
+ off = getdigits_int(&p, true, 0);
} else {
p++;
}
@@ -1392,15 +1391,14 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Compute the length of the replaced characters in
// screen characters, not bytes.
{
- int repl_size = vim_strnsize(lead_repl,
- lead_repl_len);
+ int repl_size = vim_strnsize((char_u *)lead_repl, lead_repl_len);
int old_size = 0;
- char_u *endp = p;
+ char *endp = p;
int l;
while (old_size < repl_size && p > leader) {
MB_PTR_BACK(leader, p);
- old_size += ptr2cells((char *)p);
+ old_size += ptr2cells(p);
}
l = lead_repl_len - (int)(endp - p);
if (l != 0) {
@@ -1416,11 +1414,11 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// blank-out any other chars from the old leader.
while (--p >= leader) {
- int l = utf_head_off(leader, p);
+ int l = utf_head_off((char_u *)leader, (char_u *)p);
if (l > 1) {
p -= l;
- if (ptr2cells((char *)p) > 1) {
+ if (ptr2cells(p) > 1) {
p[1] = ' ';
l--;
}
@@ -1433,19 +1431,18 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
}
} else { // left adjusted leader
- p = (char_u *)skipwhite((char *)leader);
+ p = skipwhite(leader);
// Compute the length of the replaced characters in
// screen characters, not bytes. Move the part that is
// not to be overwritten.
{
- int repl_size = vim_strnsize(lead_repl,
- lead_repl_len);
+ int repl_size = vim_strnsize((char_u *)lead_repl, lead_repl_len);
int i;
int l;
for (i = 0; i < lead_len && p[i] != NUL; i += l) {
- l = utfc_ptr2len((char *)p + i);
- if (vim_strnsize(p, i + l) > repl_size) {
+ l = utfc_ptr2len(p + i);
+ if (vim_strnsize((char_u *)p, i + l) > repl_size) {
break;
}
}
@@ -1467,10 +1464,10 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
lead_len--;
memmove(p, p + 1, (size_t)(leader + lead_len - p));
} else {
- int l = utfc_ptr2len((char *)p);
+ int l = utfc_ptr2len(p);
if (l > 1) {
- if (ptr2cells((char *)p) > 1) {
+ if (ptr2cells(p) > 1) {
// Replace a double-wide char with
// two spaces
l--;
@@ -1488,7 +1485,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Recompute the indent, it may have changed.
if (curbuf->b_p_ai || do_si) {
- newindent = get_indent_str_vtab(leader,
+ newindent = get_indent_str_vtab((char_u *)leader,
curbuf->b_p_ts,
curbuf->b_p_vts_array, false);
}
@@ -1506,7 +1503,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
while (off > 0 && lead_len > 0
&& leader[lead_len - 1] == ' ') {
// Don't do it when there is a tab before the space
- if (vim_strchr(skipwhite((char *)leader), '\t') != NULL) {
+ if (vim_strchr(skipwhite(leader), '\t') != NULL) {
break;
}
lead_len--;
@@ -1605,7 +1602,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
}
STRCAT(leader, p_extra);
- p_extra = leader;
+ p_extra = (char_u *)leader;
did_ai = true; // So truncating blanks works with comments
less_cols -= lead_len;
} else {
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 028dd70eb2..a26a7f6aaf 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -1351,10 +1351,10 @@ bool try_getdigits(char **pp, intmax_t *nr)
/// @param def Default value, if parsing fails or overflow occurs.
///
/// @return Number read from the string, or `def` on parse failure or overflow.
-intmax_t getdigits(char_u **pp, bool strict, intmax_t def)
+intmax_t getdigits(char **pp, bool strict, intmax_t def)
{
intmax_t number;
- int ok = try_getdigits((char **)pp, &number);
+ int ok = try_getdigits(pp, &number);
if (strict && !ok) {
abort();
}
@@ -1366,7 +1366,7 @@ intmax_t getdigits(char_u **pp, bool strict, intmax_t def)
/// @see getdigits
int getdigits_int(char **pp, bool strict, int def)
{
- intmax_t number = getdigits((char_u **)pp, strict, def);
+ intmax_t number = getdigits(pp, strict, def);
#if SIZEOF_INTMAX_T > SIZEOF_INT
if (strict) {
assert(number >= INT_MIN && number <= INT_MAX);
@@ -1380,7 +1380,7 @@ int getdigits_int(char **pp, bool strict, int def)
/// Gets a long number from a string.
///
/// @see getdigits
-long getdigits_long(char_u **pp, bool strict, long def)
+long getdigits_long(char **pp, bool strict, long def)
{
intmax_t number = getdigits(pp, strict, def);
#if SIZEOF_INTMAX_T > SIZEOF_LONG
@@ -1398,7 +1398,7 @@ long getdigits_long(char_u **pp, bool strict, long def)
/// @see getdigits
int32_t getdigits_int32(char **pp, bool strict, long def)
{
- intmax_t number = getdigits((char_u **)pp, strict, def);
+ intmax_t number = getdigits(pp, strict, def);
#if SIZEOF_INTMAX_T > SIZEOF_INT32_T
if (strict) {
assert(number >= INT32_MIN && number <= INT32_MAX);
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index f43eaaa299..4ad2591802 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -3066,8 +3066,8 @@ static int parse_diff_ed(char_u *line, diffhunk_T *hunk)
// change: {first}[,{last}]c{first}[,{last}]
// append: {first}a{first}[,{last}]
// delete: {first}[,{last}]d{first}
- char_u *p = line;
- linenr_T f1 = getdigits_int32((char **)&p, true, 0);
+ char *p = (char *)line;
+ linenr_T f1 = getdigits_int32(&p, true, 0);
if (*p == ',') {
p++;
l1 = getdigits(&p, true, 0);
@@ -3077,7 +3077,7 @@ static int parse_diff_ed(char_u *line, diffhunk_T *hunk)
if (*p != 'a' && *p != 'c' && *p != 'd') {
return FAIL; // invalid diff format
}
- int difftype = *p++;
+ int difftype = (uint8_t)(*p++);
long f2 = getdigits(&p, true, 0);
if (*p == ',') {
p++;
@@ -3114,7 +3114,7 @@ static int parse_diff_unified(char_u *line, diffhunk_T *hunk)
{
// Parse unified diff hunk header:
// @@ -oldline,oldcount +newline,newcount @@
- char_u *p = line;
+ char *p = (char *)line;
if (*p++ == '@' && *p++ == '@' && *p++ == ' ' && *p++ == '-') {
long oldcount;
long newline;
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 355900c93f..36f6d06512 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1662,28 +1662,28 @@ bool check_digraph_chars_valid(int char1, int char2)
/// format: {c1}{c2} char {c1}{c2} char ...
///
/// @param str
-void putdigraph(char_u *str)
+void putdigraph(char *str)
{
while (*str != NUL) {
- str = (char_u *)skipwhite((char *)str);
+ str = skipwhite(str);
if (*str == NUL) {
return;
}
- char_u char1 = *str++;
- char_u char2 = *str++;
+ uint8_t char1 = (uint8_t)(*str++);
+ uint8_t char2 = (uint8_t)(*str++);
if (!check_digraph_chars_valid(char1, char2)) {
return;
}
- str = (char_u *)skipwhite((char *)str);
+ str = skipwhite(str);
if (!ascii_isdigit(*str)) {
emsg(_(e_number_exp));
return;
}
- int n = getdigits_int((char **)&str, true, 0);
+ int n = getdigits_int(&str, true, 0);
registerdigraph(char1, char2, n);
}
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 7454e9ddab..b3cfec8709 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -2130,11 +2130,11 @@ static void f_expandcmd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
char *errormsg = NULL;
rettv->v_type = VAR_STRING;
- char_u *cmdstr = (char_u *)xstrdup(tv_get_string(&argvars[0]));
+ char *cmdstr = xstrdup(tv_get_string(&argvars[0]));
exarg_T eap = {
- .cmd = (char *)cmdstr,
- .arg = (char *)cmdstr,
+ .cmd = cmdstr,
+ .arg = cmdstr,
.usefilter = false,
.nextcmd = NULL,
.cmdidx = CMD_USER,
@@ -2145,7 +2145,7 @@ static void f_expandcmd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (errormsg != NULL && *errormsg != NUL) {
emsg(errormsg);
}
- rettv->vval.v_string = (char *)cmdstr;
+ rettv->vval.v_string = cmdstr;
}
/// "flatten(list[, {maxdepth}])" function
@@ -8347,7 +8347,7 @@ static void f_setqflist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static int get_yank_type(char_u **const pp, MotionType *const yank_type, long *const block_len)
FUNC_ATTR_NONNULL_ALL
{
- char_u *stropt = *pp;
+ char *stropt = (char *)(*pp);
switch (*stropt) {
case 'v':
case 'c': // character-wise selection
@@ -8369,7 +8369,7 @@ static int get_yank_type(char_u **const pp, MotionType *const yank_type, long *c
default:
return FAIL;
}
- *pp = stropt;
+ *pp = (char_u *)stropt;
return OK;
}
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index ab6e3ac2d5..c765b1652d 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -3597,7 +3597,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
// check for a trailing count
cmd = skipwhite(cmd);
if (ascii_isdigit(*cmd)) {
- i = getdigits_long((char_u **)&cmd, true, 0);
+ i = getdigits_long(&cmd, true, 0);
if (i <= 0 && !eap->skip && subflags.do_error) {
emsg(_(e_zerocount));
return 0;
@@ -4858,14 +4858,14 @@ void ex_help(exarg_T *eap)
semsg(_("E149: Sorry, no help for %s"), arg);
}
if (n != FAIL) {
- FreeWild(num_matches, (char_u **)matches);
+ FreeWild(num_matches, matches);
}
return;
}
// The first match (in the requested language) is the best match.
tag = xstrdup(matches[i]);
- FreeWild(num_matches, (char_u **)matches);
+ FreeWild(num_matches, matches);
/*
* Re-use an existing help window or open a new one.
@@ -5287,7 +5287,7 @@ int find_help_tags(const char *arg, int *num_matches, char ***matches, bool keep
if (keep_lang) {
flags |= TAG_KEEP_LANG;
}
- if (find_tags(IObuff, num_matches, (char_u ***)matches, flags, MAXCOL, NULL) == OK
+ if (find_tags(IObuff, num_matches, matches, flags, MAXCOL, NULL) == OK
&& *num_matches > 0) {
// Sort the matches found on the heuristic number that is after the
// tag name.
@@ -5424,8 +5424,8 @@ void fix_help_buffer(void)
// Note: We cannot just do `&NameBuff` because it is a statically sized array
// so `NameBuff == &NameBuff` according to C semantics.
char *buff_list[1] = { (char *)NameBuff };
- if (gen_expand_wildcards(1, (char_u **)buff_list, &fcount,
- (char_u ***)&fnames, EW_FILE|EW_SILENT) == OK
+ if (gen_expand_wildcards(1, buff_list, &fcount,
+ &fnames, EW_FILE|EW_SILENT) == OK
&& fcount > 0) {
// If foo.abx is found use it instead of foo.txt in
// the same directory.
@@ -5526,7 +5526,7 @@ void fix_help_buffer(void)
}
fclose(fd);
}
- FreeWild(fcount, (char_u **)fnames);
+ FreeWild(fcount, fnames);
}
}
xfree(rt);
@@ -5580,14 +5580,14 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool
// Note: We cannot just do `&NameBuff` because it is a statically sized array
// so `NameBuff == &NameBuff` according to C semantics.
char *buff_list[1] = { (char *)NameBuff };
- const int res = gen_expand_wildcards(1, (char_u **)buff_list, &filecount, (char_u ***)&files,
+ const int res = gen_expand_wildcards(1, buff_list, &filecount, &files,
EW_FILE|EW_SILENT);
if (res == FAIL || filecount == 0) {
if (!got_int) {
semsg(_("E151: No match: %s"), NameBuff);
}
if (res != FAIL) {
- FreeWild(filecount, (char_u **)files);
+ FreeWild(filecount, files);
}
return;
}
@@ -5608,7 +5608,7 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool
if (!ignore_writeerr) {
semsg(_("E152: Cannot open %s for writing"), NameBuff);
}
- FreeWild(filecount, (char_u **)files);
+ FreeWild(filecount, files);
return;
}
@@ -5698,11 +5698,11 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool
fclose(fd);
}
- FreeWild(filecount, (char_u **)files);
+ FreeWild(filecount, files);
if (!got_int && ga.ga_data != NULL) {
// Sort the tags.
- sort_strings((char_u **)ga.ga_data, ga.ga_len);
+ sort_strings(ga.ga_data, ga.ga_len);
// Check for duplicates.
for (int i = 1; i < ga.ga_len; i++) {
@@ -5777,7 +5777,7 @@ static void do_helptags(char *dirname, bool add_help_tags, bool ignore_writeerr)
// Note: We cannot just do `&NameBuff` because it is a statically sized array
// so `NameBuff == &NameBuff` according to C semantics.
char *buff_list[1] = { (char *)NameBuff };
- if (gen_expand_wildcards(1, (char_u **)buff_list, &filecount, (char_u ***)&files,
+ if (gen_expand_wildcards(1, buff_list, &filecount, &files,
EW_FILE|EW_SILENT) == FAIL
|| filecount == 0) {
semsg(_("E151: No match: %s"), NameBuff);
@@ -5843,7 +5843,7 @@ static void do_helptags(char *dirname, bool add_help_tags, bool ignore_writeerr)
}
ga_clear(&ga);
- FreeWild(filecount, (char_u **)files);
+ FreeWild(filecount, files);
}
static void helptags_cb(char *fname, void *cookie)
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 540e7224c1..730a2f1b69 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -857,7 +857,7 @@ static void get_arglist(garray_T *gap, char *str, int escaped)
/// "fnames[fcountp]". When "wig" is true, removes files matching 'wildignore'.
///
/// @return FAIL or OK.
-int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, bool wig)
+int get_arglist_exp(char_u *str, int *fcountp, char ***fnamesp, bool wig)
{
garray_T ga;
int i;
@@ -865,10 +865,10 @@ int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, bool wig)
get_arglist(&ga, (char *)str, true);
if (wig) {
- i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
+ i = expand_wildcards(ga.ga_len, ga.ga_data,
fcountp, fnamesp, EW_FILE|EW_NOTFOUND|EW_NOTWILD);
} else {
- i = gen_expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
+ i = gen_expand_wildcards(ga.ga_len, ga.ga_data,
fcountp, fnamesp, EW_FILE|EW_NOTFOUND|EW_NOTWILD);
}
@@ -950,8 +950,8 @@ static int do_arglist(char *str, int what, int after, bool will_edit)
}
ga_clear(&new_ga);
} else {
- int i = expand_wildcards(new_ga.ga_len, (char_u **)new_ga.ga_data,
- &exp_count, (char_u ***)&exp_files,
+ int i = expand_wildcards(new_ga.ga_len, new_ga.ga_data,
+ &exp_count, &exp_files,
EW_DIR|EW_FILE|EW_ADDSLASH|EW_NOTFOUND);
ga_clear(&new_ga);
if (i == FAIL || exp_count == 0) {
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index bf78de1f8c..3127c7e922 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1396,7 +1396,7 @@ static int parse_count(exarg_T *eap, char **errormsg, bool validate)
if ((eap->argt & EX_COUNT) && ascii_isdigit(*eap->arg)
&& (!(eap->argt & EX_BUFNAME) || *(p = skipdigits(eap->arg + 1)) == NUL
|| ascii_iswhite(*p))) {
- n = getdigits_long((char_u **)&eap->arg, false, -1);
+ n = getdigits_long(&eap->arg, false, -1);
eap->arg = skipwhite(eap->arg);
if (n <= 0 && (eap->argt & EX_ZEROR) == 0) {
if (errormsg != NULL) {
@@ -1624,7 +1624,7 @@ int execute_cmd(exarg_T *eap, CmdParseInfo *cmdinfo, bool preview)
// If filename expansion is enabled, expand filenames
if (cmdinfo->magic.file) {
- if (expand_filename(eap, (char_u **)eap->cmdlinep, &errormsg) == FAIL) {
+ if (expand_filename(eap, eap->cmdlinep, &errormsg) == FAIL) {
goto end;
}
}
@@ -2290,7 +2290,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
}
if (ea.argt & EX_XFILE) {
- if (expand_filename(&ea, (char_u **)cmdlinep, &errormsg) == FAIL) {
+ if (expand_filename(&ea, cmdlinep, &errormsg) == FAIL) {
goto doend;
}
}
@@ -4489,7 +4489,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
default:
if (ascii_isdigit(*cmd)) { // absolute line number
- lnum = (linenr_T)getdigits((char_u **)&cmd, false, 0);
+ lnum = (linenr_T)getdigits(&cmd, false, 0);
}
}
@@ -4809,7 +4809,7 @@ char *replace_makeprg(exarg_T *eap, char *p, char **cmdlinep)
/// When an error is detected, "errormsgp" is set to a non-NULL pointer.
///
/// @return FAIL for failure, OK otherwise.
-int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp)
+int expand_filename(exarg_T *eap, char **cmdlinep, char **errormsgp)
{
int has_wildcards; // need to expand wildcards
char *repl;
@@ -4915,7 +4915,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp)
repl = l;
}
- p = repl_cmdline(eap, p, srclen, repl, (char **)cmdlinep);
+ p = repl_cmdline(eap, p, srclen, repl, cmdlinep);
xfree(repl);
}
@@ -4942,7 +4942,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp)
p = NULL;
}
if (p != NULL) {
- (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, (char **)cmdlinep);
+ (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, cmdlinep);
}
}
@@ -4969,7 +4969,7 @@ int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp)
if (p == NULL) {
return FAIL;
}
- (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, (char **)cmdlinep);
+ (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, cmdlinep);
xfree(p);
}
}
@@ -5253,7 +5253,7 @@ static int get_tabpage_arg(exarg_T *eap)
}
p_save = p;
- tab_number = (int)getdigits((char_u **)&p, false, tab_number);
+ tab_number = (int)getdigits(&p, false, tab_number);
if (relative == 0) {
if (STRCMP(p, "$") == 0) {
@@ -5949,7 +5949,7 @@ two_count:
return FAIL;
}
- *def = getdigits_long((char_u **)&p, true, 0);
+ *def = getdigits_long(&p, true, 0);
*argt |= EX_ZEROR;
if (p != val + vallen || vallen == 0) {
@@ -5975,7 +5975,7 @@ invalid_count:
goto two_count;
}
- *def = getdigits_long((char_u **)&p, true, 0);
+ *def = getdigits_long(&p, true, 0);
if (p != val + vallen) {
goto invalid_count;
@@ -7757,7 +7757,7 @@ static void ex_tabnext(exarg_T *eap)
if (eap->arg && *eap->arg != NUL) {
char *p = eap->arg;
char *p_save = p;
- tab_number = (int)getdigits((char_u **)&p, false, 0);
+ tab_number = (int)getdigits(&p, false, 0);
if (p == p_save || *p_save == '-' || *p_save == '+' || *p != NUL
|| tab_number == 0) {
// No numbers as argument.
@@ -8738,7 +8738,7 @@ static void ex_later(exarg_T *eap)
if (*p == NUL) {
count = 1;
} else if (isdigit(*p)) {
- count = getdigits_long((char_u **)&p, false, 0);
+ count = getdigits_long(&p, false, 0);
switch (*p) {
case 's':
++p; sec = true; break;
@@ -9255,7 +9255,7 @@ static void ex_findpat(exarg_T *eap)
n = 1;
if (ascii_isdigit(*eap->arg)) { // get count
- n = getdigits_long((char_u **)&eap->arg, false, 0);
+ n = getdigits_long(&eap->arg, false, 0);
eap->arg = skipwhite(eap->arg);
}
if (*eap->arg == '/') { // Match regexp, not just whole words
@@ -10013,7 +10013,7 @@ static void ex_setfiletype(exarg_T *eap)
static void ex_digraphs(exarg_T *eap)
{
if (*eap->arg != NUL) {
- putdigraph((char_u *)eap->arg);
+ putdigraph(eap->arg);
} else {
listdigraphs(eap->forceit);
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index a6e8ad433f..6240ac6b37 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -4165,8 +4165,7 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode
compl_selected = findex;
cmdline_pum_display(false);
} else if (p_wmnu) {
- win_redr_status_matches(xp, xp->xp_numfiles, (char_u **)xp->xp_files,
- findex, cmd_showtail);
+ win_redr_status_matches(xp, xp->xp_numfiles, xp->xp_files, findex, cmd_showtail);
}
if (findex == -1) {
return vim_strsave(orig_save);
@@ -4186,7 +4185,7 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode
// free old names
if (xp->xp_numfiles != -1 && mode != WILD_ALL && mode != WILD_LONGEST) {
- FreeWild(xp->xp_numfiles, (char_u **)xp->xp_files);
+ FreeWild(xp->xp_numfiles, xp->xp_files);
xp->xp_numfiles = -1;
XFREE_CLEAR(orig_save);
}
@@ -4204,8 +4203,7 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode
/*
* Do the expansion.
*/
- if (ExpandFromContext(xp, str, &xp->xp_numfiles, (char_u ***)&xp->xp_files,
- options) == FAIL) {
+ if (ExpandFromContext(xp, str, &xp->xp_numfiles, &xp->xp_files, options) == FAIL) {
#ifdef FNAME_ILLEGAL
/* Illegal file name has been silently skipped. But when there
* are wildcards, the real problem is that there was no match,
@@ -4221,7 +4219,7 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode
}
} else {
// Escape the matches for use on the command line.
- ExpandEscape(xp, str, xp->xp_numfiles, (char_u **)xp->xp_files, options);
+ ExpandEscape(xp, str, xp->xp_numfiles, xp->xp_files, options);
/*
* Check for matching suffixes in file names.
@@ -4346,12 +4344,12 @@ void ExpandInit(expand_T *xp)
void ExpandCleanup(expand_T *xp)
{
if (xp->xp_numfiles >= 0) {
- FreeWild(xp->xp_numfiles, (char_u **)xp->xp_files);
+ FreeWild(xp->xp_numfiles, xp->xp_files);
xp->xp_numfiles = -1;
}
}
-void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int options)
+void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char **files, int options)
{
int i;
char_u *p;
@@ -4377,9 +4375,9 @@ void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int o
for (i = 0; i < numfiles; ++i) {
// for ":set path=" we need to escape spaces twice
if (xp->xp_backslash == XP_BS_THREE) {
- p = vim_strsave_escaped(files[i], (char_u *)" ");
+ p = vim_strsave_escaped((char_u *)files[i], (char_u *)" ");
xfree(files[i]);
- files[i] = p;
+ files[i] = (char *)p;
#if defined(BACKSLASH_IN_FILENAME)
p = vim_strsave_escaped(files[i], (char_u *)" ");
xfree(files[i]);
@@ -4393,7 +4391,7 @@ void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int o
xp->xp_shell ? VSE_SHELL : vse_what);
#endif
xfree(files[i]);
- files[i] = p;
+ files[i] = (char *)p;
/* If 'str' starts with "\~", replace "~" at start of
* files[i] with "\~". */
@@ -4413,10 +4411,10 @@ void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int o
* Insert a backslash before characters in a tag name that
* would terminate the ":tag" command.
*/
- for (i = 0; i < numfiles; ++i) {
- p = vim_strsave_escaped(files[i], (char_u *)"\\|\"");
+ for (i = 0; i < numfiles; i++) {
+ p = vim_strsave_escaped((char_u *)files[i], (char_u *)"\\|\"");
xfree(files[i]);
- files[i] = p;
+ files[i] = (char *)p;
}
}
}
@@ -4472,7 +4470,7 @@ char *vim_strsave_fnameescape(const char *const fname, const int what)
// '>' and '+' are special at the start of some commands, e.g. ":edit" and
// ":write". "cd -" has a special meaning.
if (*p == '>' || *p == '+' || (*p == '-' && p[1] == NUL)) {
- escape_fname((char_u **)&p);
+ escape_fname(&p);
}
return p;
@@ -4481,28 +4479,26 @@ char *vim_strsave_fnameescape(const char *const fname, const int what)
/*
* Put a backslash before the file name in "pp", which is in allocated memory.
*/
-static void escape_fname(char_u **pp)
+static void escape_fname(char **pp)
{
char_u *p = xmalloc(STRLEN(*pp) + 2);
p[0] = '\\';
STRCPY(p + 1, *pp);
xfree(*pp);
- *pp = p;
+ *pp = (char *)p;
}
-/*
- * For each file name in files[num_files]:
- * If 'orig_pat' starts with "~/", replace the home directory with "~".
- */
-void tilde_replace(char_u *orig_pat, int num_files, char_u **files)
+/// For each file name in files[num_files]:
+/// If 'orig_pat' starts with "~/", replace the home directory with "~".
+void tilde_replace(char_u *orig_pat, int num_files, char **files)
{
char *p;
if (orig_pat[0] == '~' && vim_ispathsep(orig_pat[1])) {
for (int i = 0; i < num_files; i++) {
- p = home_replace_save(NULL, (char *)files[i]);
+ p = home_replace_save(NULL, files[i]);
xfree(files[i]);
- files[i] = (char_u *)p;
+ files[i] = p;
}
}
}
@@ -4523,7 +4519,7 @@ static int showmatches(expand_T *xp, int wildmenu)
#define L_SHOWFILE(m) (showtail \
? sm_gettail(files_found[m], false) : files_found[m])
int num_files;
- char_u **files_found;
+ char **files_found;
int i, j, k;
int maxlen;
int lines;
@@ -4543,7 +4539,7 @@ static int showmatches(expand_T *xp, int wildmenu)
}
} else {
num_files = xp->xp_numfiles;
- files_found = (char_u **)xp->xp_files;
+ files_found = xp->xp_files;
showtail = cmd_showtail;
}
@@ -4558,10 +4554,9 @@ static int showmatches(expand_T *xp, int wildmenu)
compl_match_array = xcalloc((size_t)compl_match_arraysize,
sizeof(pumitem_T));
for (i = 0; i < num_files; i++) {
- compl_match_array[i].pum_text = L_SHOWFILE(i);
+ compl_match_array[i].pum_text = (char_u *)L_SHOWFILE(i);
}
- char_u *endpos = (showtail
- ? sm_gettail((char_u *)xp->xp_pattern, true) : (char_u *)xp->xp_pattern);
+ char_u *endpos = (char_u *)(showtail ? sm_gettail(xp->xp_pattern, true) : xp->xp_pattern);
if (ui_has(kUICmdline)) {
compl_startcol = (int)(endpos - ccline.cmdbuff);
} else {
@@ -4593,10 +4588,10 @@ static int showmatches(expand_T *xp, int wildmenu)
if (!showtail && (xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_SHELLCMD
|| xp->xp_context == EXPAND_BUFFERS)) {
- home_replace(NULL, (char *)files_found[i], (char *)NameBuff, MAXPATHL, true);
+ home_replace(NULL, files_found[i], (char *)NameBuff, MAXPATHL, true);
j = vim_strsize((char *)NameBuff);
} else {
- j = vim_strsize((char *)L_SHOWFILE(i));
+ j = vim_strsize(L_SHOWFILE(i));
}
if (j > maxlen) {
maxlen = j;
@@ -4629,8 +4624,8 @@ static int showmatches(expand_T *xp, int wildmenu)
lastlen = 999;
for (k = i; k < num_files; k += lines) {
if (xp->xp_context == EXPAND_TAGS_LISTFILES) {
- msg_outtrans_attr(files_found[k], HL_ATTR(HLF_D));
- p = files_found[k] + STRLEN(files_found[k]) + 1;
+ msg_outtrans_attr((char_u *)files_found[k], HL_ATTR(HLF_D));
+ p = (char_u *)files_found[k] + STRLEN(files_found[k]) + 1;
msg_advance(maxlen + 1);
msg_puts((const char *)p);
msg_advance(maxlen + 3);
@@ -4648,8 +4643,8 @@ static int showmatches(expand_T *xp, int wildmenu)
// Expansion was done before and special characters
// were escaped, need to halve backslashes. Also
// $HOME has been replaced with ~/.
- char_u *exp_path = expand_env_save_opt(files_found[k], true);
- char_u *path = exp_path != NULL ? exp_path : files_found[k];
+ char_u *exp_path = expand_env_save_opt((char_u *)files_found[k], true);
+ char_u *path = exp_path != NULL ? exp_path : (char_u *)files_found[k];
char_u *halved_slash = backslash_halve_save(path);
j = os_isdir(halved_slash);
xfree(exp_path);
@@ -4658,17 +4653,17 @@ static int showmatches(expand_T *xp, int wildmenu)
}
} else {
// Expansion was done here, file names are literal.
- j = os_isdir(files_found[k]);
+ j = os_isdir((char_u *)files_found[k]);
}
if (showtail) {
- p = L_SHOWFILE(k);
+ p = (char_u *)L_SHOWFILE(k);
} else {
- home_replace(NULL, (char *)files_found[k], (char *)NameBuff, MAXPATHL, true);
+ home_replace(NULL, files_found[k], (char *)NameBuff, MAXPATHL, true);
p = NameBuff;
}
} else {
- j = FALSE;
- p = L_SHOWFILE(k);
+ j = false;
+ p = (char_u *)L_SHOWFILE(k);
}
lastlen = msg_outtrans_attr(p, j ? attr : 0);
}
@@ -4697,17 +4692,15 @@ static int showmatches(expand_T *xp, int wildmenu)
return EXPAND_OK;
}
-/*
- * Private path_tail for showmatches() (and win_redr_status_matches()):
- * Find tail of file name path, but ignore trailing "/".
- */
-char_u *sm_gettail(char_u *s, bool eager)
+/// Private path_tail for showmatches() (and win_redr_status_matches()):
+/// Find tail of file name path, but ignore trailing "/".
+char *sm_gettail(char *s, bool eager)
{
char_u *p;
- char_u *t = s;
- int had_sep = FALSE;
+ char_u *t = (char_u *)s;
+ int had_sep = false;
- for (p = s; *p != NUL;) {
+ for (p = (char_u *)s; *p != NUL;) {
if (vim_ispathsep(*p)
#ifdef BACKSLASH_IN_FILENAME
&& !rem_backslash(p)
@@ -4724,7 +4717,7 @@ char_u *sm_gettail(char_u *s, bool eager)
}
MB_PTR_ADV(p);
}
- return t;
+ return (char *)t;
}
/*
@@ -5002,7 +4995,7 @@ void set_cmd_context(expand_T *xp, char_u *str, int len, int col, int use_ccline
/// @param col position of cursor
/// @param matchcount return: nr of matches
/// @param matches return: array of pointers to matches
-int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches)
+int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount, char ***matches)
{
char_u *file_str = NULL;
int options = WILD_ADD_SLASH|WILD_SILENT;
@@ -5038,7 +5031,7 @@ int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount, char_u *
// Cleanup matches for help tags:
// Remove "@ab" if the top of 'helplang' is "ab" and the language of the first
// tag matches it. Otherwise remove "@en" if "en" is the only language.
-static void cleanup_help_tags(int num_file, char_u **file)
+static void cleanup_help_tags(int num_file, char **file)
{
char_u buf[4];
char_u *p = buf;
@@ -5092,7 +5085,7 @@ typedef char *(*ExpandFunc)(expand_T *, int);
/// Do the expansion based on xp->xp_context and "pat".
///
/// @param options WILD_ flags
-static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char_u ***file, int options)
+static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char ***file, int options)
{
regmatch_T regmatch;
int ret;
@@ -5187,7 +5180,7 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char_u **
/* 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 ? "help" : (char *)pat,
- num_file, (char ***)file, false) == OK) {
+ num_file, file, false) == OK) {
cleanup_help_tags(*num_file, *file);
return OK;
}
@@ -5204,10 +5197,10 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char_u **
return OK;
}
if (xp->xp_context == EXPAND_BUFFERS) {
- return ExpandBufnames((char *)pat, num_file, (char ***)file, options);
+ return ExpandBufnames((char *)pat, num_file, file, options);
}
if (xp->xp_context == EXPAND_DIFF_BUFFERS) {
- return ExpandBufnames((char *)pat, num_file, (char ***)file, options | BUF_DIFF_FILTER);
+ return ExpandBufnames((char *)pat, num_file, file, options | BUF_DIFF_FILTER);
}
if (xp->xp_context == EXPAND_TAGS
|| xp->xp_context == EXPAND_TAGS_LISTFILES) {
@@ -5215,8 +5208,7 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char_u **
}
if (xp->xp_context == EXPAND_COLORS) {
char *directories[] = { "colors", NULL };
- return ExpandRTDir(pat, DIP_START + DIP_OPT + DIP_LUA, num_file, file,
- directories);
+ return ExpandRTDir(pat, DIP_START + DIP_OPT + DIP_LUA, num_file, file, directories);
}
if (xp->xp_context == EXPAND_COMPILER) {
char *directories[] = { "compiler", NULL };
@@ -5323,8 +5315,7 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char_u **
if (tab[i].ic) {
regmatch.rm_ic = TRUE;
}
- ExpandGeneric(xp, &regmatch, num_file, file, tab[i].func,
- tab[i].escaped);
+ ExpandGeneric(xp, &regmatch, num_file, file, tab[i].func, tab[i].escaped);
ret = OK;
break;
}
@@ -5344,7 +5335,7 @@ static int ExpandFromContext(expand_T *xp, char_u *pat, int *num_file, char_u **
/// program. Matching strings are copied into an array, which is returned.
///
/// @param func returns a string from the list
-static void ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file,
+static void ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, char ***file,
CompleteListItemGetter func, int escaped)
{
int i;
@@ -5369,7 +5360,7 @@ static void ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, cha
}
assert(count < INT_MAX);
*num_file = (int)count;
- *file = (char_u **)xmalloc(count * sizeof(char_u *));
+ *file = xmalloc(count * sizeof(char_u *));
// copy the matching names into allocated memory
count = 0;
@@ -5387,7 +5378,7 @@ static void ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, cha
} else {
str = vim_strsave(str);
}
- (*file)[count++] = str;
+ (*file)[count++] = (char *)str;
if (func == get_menu_names) {
// Test for separator added by get_menu_names().
str += STRLEN(str) - 1;
@@ -5424,14 +5415,14 @@ static void ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, cha
/// *file will either be set to NULL or point to
/// allocated memory.
/// @param flagsarg is a combination of EW_* flags.
-static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, int flagsarg)
+static void expand_shellcmd(char_u *filepat, int *num_file, char ***file, int flagsarg)
FUNC_ATTR_NONNULL_ALL
{
char_u *pat;
int i;
char_u *path = NULL;
garray_T ga;
- char_u *buf = xmalloc(MAXPATHL);
+ char *buf = xmalloc(MAXPATHL);
size_t l;
char_u *s, *e;
int flags = flagsarg;
@@ -5498,7 +5489,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, int
break;
}
STRLCPY(buf, s, l + 1);
- add_pathsep((char *)buf);
+ add_pathsep(buf);
l = STRLEN(buf);
STRLCPY(buf + l, pat, MAXPATHL - l);
@@ -5508,7 +5499,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, int
ga_grow(&ga, *num_file);
{
for (i = 0; i < *num_file; i++) {
- char_u *name = (*file)[i];
+ char_u *name = (char_u *)(*file)[i];
if (STRLEN(name) > l) {
// Check if this name was already found.
@@ -5547,7 +5538,7 @@ static void expand_shellcmd(char_u *filepat, int *num_file, char_u ***file, int
/// Call "user_expand_func()" to invoke a user defined Vim script function and
/// return the result (either a string, a List or NULL).
static void *call_user_expand_func(user_expand_func_T user_expand_func, expand_T *xp, int *num_file,
- char_u ***file)
+ char ***file)
FUNC_ATTR_NONNULL_ALL
{
char_u keep = 0;
@@ -5588,10 +5579,8 @@ static void *call_user_expand_func(user_expand_func_T user_expand_func, expand_T
return ret;
}
-/*
- * Expand names with a function defined by the user.
- */
-static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)
+/// Expand names with a function defined by the user.
+static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file, char ***file)
{
char_u *e;
garray_T ga;
@@ -5629,10 +5618,8 @@ static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file,
return OK;
}
-/*
- * Expand names with a list returned by a function defined by the user.
- */
-static int ExpandUserList(expand_T *xp, int *num_file, char_u ***file)
+/// Expand names with a list returned by a function defined by the user.
+static int ExpandUserList(expand_T *xp, int *num_file, char ***file)
{
list_T *const retlist = call_user_expand_func((user_expand_func_T)call_func_retlist, xp, num_file,
file);
@@ -5658,7 +5645,7 @@ static int ExpandUserList(expand_T *xp, int *num_file, char_u ***file)
return OK;
}
-static int ExpandUserLua(expand_T *xp, int *num_file, char_u ***file)
+static int ExpandUserLua(expand_T *xp, int *num_file, char ***file)
{
typval_T rettv;
nlua_call_user_expand_func(xp, &rettv);
@@ -5696,7 +5683,7 @@ static int ExpandUserLua(expand_T *xp, int *num_file, char_u ***file)
/// 'packpath'/pack/ * /opt/ * /{dirnames}/{pat}.vim
/// When "flags" has DIP_LUA: search also performed for .lua files
/// "dirnames" is an array with one or more directory names.
-static int ExpandRTDir(char_u *pat, int flags, int *num_file, char_u ***file, char *dirnames[])
+static int ExpandRTDir(char_u *pat, int flags, int *num_file, char ***file, char *dirnames[])
{
*num_file = 0;
*file = NULL;
@@ -5805,7 +5792,7 @@ static int ExpandRTDir(char_u *pat, int flags, int *num_file, char_u ***file, ch
/// Expand loadplugin names:
/// 'packpath'/pack/ * /opt/{pat}
-static int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file)
+static int ExpandPackAddDir(char_u *pat, int *num_file, char ***file)
{
garray_T ga;
@@ -5859,7 +5846,7 @@ void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options)
add_pathsep((char *)buf);
STRCAT(buf, file); // NOLINT
- char_u **p;
+ char **p;
int num_p = 0;
(void)ExpandFromContext(&xpc, buf, &num_p, &p,
WILD_SILENT | expand_options);
@@ -5870,7 +5857,7 @@ void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options)
ga_grow(ga, num_p);
// take over the pointers and put them in "ga"
for (int i = 0; i < num_p; i++) {
- ((char_u **)ga->ga_data)[ga->ga_len] = p[i];
+ ((char_u **)ga->ga_data)[ga->ga_len] = (char_u *)p[i];
ga->ga_len++;
}
xfree(p);
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index ca276b8a40..810684eb61 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -82,10 +82,9 @@ typedef struct ff_stack {
char_u *ffs_fix_path;
char_u *ffs_wc_path;
- /* files/dirs found in the above directory, matched by the first wildcard
- * of wc_part
- */
- char_u **ffs_filearray;
+ // files/dirs found in the above directory, matched by the first wildcard
+ // of wc_part
+ char **ffs_filearray;
int ffs_filearray_size;
char_u ffs_filearray_cur; // needed for partly handled dirs
@@ -683,12 +682,12 @@ char_u *vim_findfile(void *search_ctx_arg)
* to handle the expansion of '**' into an empty string.
*/
if (stackp->ffs_filearray == NULL) {
- char_u *dirptrs[2];
+ char *dirptrs[2];
/* we use filepath to build the path expand_wildcards() should
* expand.
*/
- dirptrs[0] = file_path;
+ dirptrs[0] = (char *)file_path;
dirptrs[1] = NULL;
// if we have a start dir copy it in
@@ -743,7 +742,7 @@ char_u *vim_findfile(void *search_ctx_arg)
if (stackp->ffs_star_star_empty == 0) {
// if not done before, expand '**' to empty
stackp->ffs_star_star_empty = 1;
- dirptrs[1] = stackp->ffs_fix_path;
+ dirptrs[1] = (char *)stackp->ffs_fix_path;
}
}
@@ -773,9 +772,9 @@ char_u *vim_findfile(void *search_ctx_arg)
* Expand wildcards like "*" and "$VAR".
* If the path is a URL don't try this.
*/
- if (path_with_url((char *)dirptrs[0])) {
+ if (path_with_url(dirptrs[0])) {
stackp->ffs_filearray = xmalloc(sizeof(char *));
- stackp->ffs_filearray[0] = vim_strsave(dirptrs[0]);
+ stackp->ffs_filearray[0] = xstrdup(dirptrs[0]);
stackp->ffs_filearray_size = 1;
} else {
/* Add EW_NOTWILD because the expanded path may contain
@@ -801,10 +800,9 @@ char_u *vim_findfile(void *search_ctx_arg)
* We don't have further wildcards to expand, so we have to
* check for the final file now.
*/
- for (int i = stackp->ffs_filearray_cur;
- i < stackp->ffs_filearray_size; ++i) {
- if (!path_with_url((char *)stackp->ffs_filearray[i])
- && !os_isdir(stackp->ffs_filearray[i])) {
+ for (int i = stackp->ffs_filearray_cur; i < stackp->ffs_filearray_size; i++) {
+ if (!path_with_url(stackp->ffs_filearray[i])
+ && !os_isdir((char_u *)stackp->ffs_filearray[i])) {
continue; // not a directory
}
// prepare the filename to be checked for existence below
@@ -897,17 +895,13 @@ char_u *vim_findfile(void *search_ctx_arg)
}
}
} else {
- /*
- * still wildcards left, push the directories for further
- * search
- */
- for (int i = stackp->ffs_filearray_cur;
- i < stackp->ffs_filearray_size; ++i) {
- if (!os_isdir(stackp->ffs_filearray[i])) {
+ // still wildcards left, push the directories for further search
+ for (int i = stackp->ffs_filearray_cur; i < stackp->ffs_filearray_size; i++) {
+ if (!os_isdir((char_u *)stackp->ffs_filearray[i])) {
continue; // not a directory
}
ff_push(search_ctx,
- ff_create_stack_element(stackp->ffs_filearray[i],
+ ff_create_stack_element((char_u *)stackp->ffs_filearray[i],
rest_of_wildcards,
stackp->ffs_level - 1, 0));
}
@@ -927,11 +921,11 @@ char_u *vim_findfile(void *search_ctx_arg)
stackp->ffs_fix_path) == 0) {
continue; // don't repush same directory
}
- if (!os_isdir(stackp->ffs_filearray[i])) {
+ if (!os_isdir((char_u *)stackp->ffs_filearray[i])) {
continue; // not a directory
}
ff_push(search_ctx,
- ff_create_stack_element(stackp->ffs_filearray[i],
+ ff_create_stack_element((char_u *)stackp->ffs_filearray[i],
stackp->ffs_wc_path, stackp->ffs_level - 1, 1));
}
}
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 5b8dd35c43..b98984017b 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -710,7 +710,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
fenc_alloced = false;
} else {
fenc_next = (char *)p_fencs; // try items in 'fileencodings'
- fenc = (char *)next_fenc((char_u **)&fenc_next, &fenc_alloced);
+ fenc = (char *)next_fenc(&fenc_next, &fenc_alloced);
}
/*
@@ -804,7 +804,7 @@ retry:
xfree(fenc);
}
if (fenc_next != NULL) {
- fenc = (char *)next_fenc((char_u **)&fenc_next, &fenc_alloced);
+ fenc = (char *)next_fenc(&fenc_next, &fenc_alloced);
} else {
fenc = "";
fenc_alloced = false;
@@ -2060,7 +2060,7 @@ void set_forced_fenc(exarg_T *eap)
/// NULL.
/// When *pp is not set to NULL, the result is in allocated memory and "alloced"
/// is set to true.
-static char_u *next_fenc(char_u **pp, bool *alloced)
+static char_u *next_fenc(char **pp, bool *alloced)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET
{
char_u *p;
@@ -2071,13 +2071,13 @@ static char_u *next_fenc(char_u **pp, bool *alloced)
*pp = NULL;
return (char_u *)"";
}
- p = (char_u *)vim_strchr((char *)(*pp), ',');
+ p = (char_u *)vim_strchr((*pp), ',');
if (p == NULL) {
- r = enc_canonize(*pp);
+ r = enc_canonize((char_u *)(*pp));
*pp += STRLEN(*pp);
} else {
- r = vim_strnsave(*pp, (size_t)(p - *pp));
- *pp = p + 1;
+ r = vim_strnsave((char_u *)(*pp), (size_t)(p - (char_u *)(*pp)));
+ *pp = (char *)p + 1;
p = enc_canonize(r);
xfree(r);
r = p;
@@ -5400,7 +5400,7 @@ int readdir_core(garray_T *gap, const char *path, void *context, CheckItem check
os_closedir(&dir);
if (gap->ga_len > 0) {
- sort_strings((char_u **)gap->ga_data, gap->ga_len);
+ sort_strings(gap->ga_data, gap->ga_len);
}
return OK;
diff --git a/src/nvim/garray.c b/src/nvim/garray.c
index 0c76e1a919..7a3c14b1bb 100644
--- a/src/nvim/garray.c
+++ b/src/nvim/garray.c
@@ -116,7 +116,7 @@ void ga_grow(garray_T *gap, int n)
/// @param gap
void ga_remove_duplicate_strings(garray_T *gap)
{
- char_u **fnames = gap->ga_data;
+ char **fnames = gap->ga_data;
// sort the growing array, which puts duplicates next to each other
sort_strings(fnames, gap->ga_len);
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index a4cf65e816..d7f7b8eb92 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -639,7 +639,7 @@ void ex_hardcopy(exarg_T *eap)
char *errormsg = NULL;
// Expand things like "%.ps".
- if (expand_filename(eap, (char_u **)eap->cmdlinep, &errormsg) == FAIL) {
+ if (expand_filename(eap, eap->cmdlinep, &errormsg) == FAIL) {
if (errormsg != NULL) {
emsg(errormsg);
}
diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c
index e209192c2f..2fc8f1dadc 100644
--- a/src/nvim/insexpand.c
+++ b/src/nvim/insexpand.c
@@ -202,7 +202,7 @@ static bool compl_started = false;
static int ctrl_x_mode = CTRL_X_NORMAL;
static int compl_matches = 0;
-static char_u *compl_pattern = NULL;
+static char *compl_pattern = NULL;
static Direction compl_direction = FORWARD;
static Direction compl_shows_dir = FORWARD;
static int compl_pending = 0; ///< > 1 for postponed CTRL-N
@@ -824,14 +824,14 @@ static void ins_compl_longest_match(compl_T *match)
/// Add an array of matches to the list of matches.
/// Frees matches[].
-static void ins_compl_add_matches(int num_matches, char_u **matches, int icase)
+static void ins_compl_add_matches(int num_matches, char **matches, int icase)
FUNC_ATTR_NONNULL_ALL
{
int add_r = OK;
Direction dir = compl_direction;
for (int i = 0; i < num_matches && add_r != FAIL; i++) {
- if ((add_r = ins_compl_add(matches[i], -1, NULL, NULL, false, NULL, dir,
+ if ((add_r = ins_compl_add((char_u *)matches[i], -1, NULL, NULL, false, NULL, dir,
CP_FAST | (icase ? CP_ICASE : 0),
false)) == OK) {
// If dir was BACKWARD then honor it just once.
@@ -1135,11 +1135,11 @@ void ins_compl_show_pum(void)
/// @param thesaurus Thesaurus completion
static void ins_compl_dictionaries(char_u *dict_start, char_u *pat, int flags, int thesaurus)
{
- char_u *dict = dict_start;
+ char *dict = (char *)dict_start;
char_u *ptr;
- char_u *buf;
+ char *buf;
regmatch_T regmatch;
- char_u **files;
+ char **files;
int count;
int save_p_scs;
Direction dir = compl_direction;
@@ -1148,7 +1148,7 @@ static void ins_compl_dictionaries(char_u *dict_start, char_u *pat, int flags, i
// When 'dictionary' is empty and spell checking is enabled use
// "spell".
if (!thesaurus && curwin->w_p_spell) {
- dict = (char_u *)"spell";
+ dict = "spell";
} else {
return;
}
@@ -1193,10 +1193,10 @@ static void ins_compl_dictionaries(char_u *dict_start, char_u *pat, int flags, i
// Expand wildcards in the dictionary name, but do not allow
// backticks (for security, the 'dict' option may have been set in
// a modeline).
- copy_option_part((char **)&dict, (char *)buf, LSIZE, ",");
+ copy_option_part(&dict, buf, LSIZE, ",");
if (!thesaurus && STRCMP(buf, "spell") == 0) {
count = -1;
- } else if (vim_strchr((char *)buf, '`') != NULL
+ } else if (vim_strchr(buf, '`') != NULL
|| expand_wildcards(1, &buf, &count, &files,
EW_FILE|EW_SILENT) != OK) {
count = 0;
@@ -1214,7 +1214,7 @@ static void ins_compl_dictionaries(char_u *dict_start, char_u *pat, int flags, i
spell_dump_compl(ptr, regmatch.rm_ic, &dir, 0);
} else if (count > 0) { // avoid warning for using "files" uninit
ins_compl_files(count, files, thesaurus, flags,
- &regmatch, buf, &dir);
+ &regmatch, (char_u *)buf, &dir);
if (flags != DICT_EXACT) {
FreeWild(count, files);
}
@@ -1230,8 +1230,8 @@ theend:
xfree(buf);
}
-static void ins_compl_files(int count, char_u **files, int thesaurus, int flags,
- regmatch_T *regmatch, char_u *buf, Direction *dir)
+static void ins_compl_files(int count, char **files, int thesaurus, int flags, regmatch_T *regmatch,
+ char_u *buf, Direction *dir)
FUNC_ATTR_NONNULL_ARG(2, 7)
{
char_u *ptr;
@@ -1240,11 +1240,11 @@ static void ins_compl_files(int count, char_u **files, int thesaurus, int flags,
int add_r;
for (i = 0; i < count && !got_int && !compl_interrupted; i++) {
- fp = os_fopen((char *)files[i], "r"); // open dictionary file
+ fp = os_fopen(files[i], "r"); // open dictionary file
if (flags != DICT_EXACT) {
msg_hist_off = true; // reset in msg_trunc_attr()
vim_snprintf((char *)IObuff, IOSIZE,
- _("Scanning dictionary: %s"), (char *)files[i]);
+ _("Scanning dictionary: %s"), files[i]);
(void)msg_trunc_attr((char *)IObuff, true, HL_ATTR(HLF_R));
}
@@ -1266,7 +1266,7 @@ static void ins_compl_files(int count, char_u **files, int thesaurus, int flags,
}
add_r = ins_compl_add_infercase(regmatch->startp[0],
(int)(ptr - regmatch->startp[0]),
- p_ic, files[i], *dir, false);
+ p_ic, (char_u *)files[i], *dir, false);
if (thesaurus) {
char_u *wstart;
@@ -1297,7 +1297,7 @@ static void ins_compl_files(int count, char_u **files, int thesaurus, int flags,
// Add the word. Skip the regexp match.
if (wstart != regmatch->startp[0]) {
add_r = ins_compl_add_infercase(wstart, (int)(ptr - wstart),
- p_ic, files[i], *dir, false);
+ p_ic, (char_u *)files[i], *dir, false);
}
}
}
@@ -2480,7 +2480,7 @@ static int ins_compl_get_exp(pos_T *ini)
static buf_T *ins_buf = NULL; // buffer being scanned
pos_T *pos;
- char_u **matches;
+ char **matches;
int save_p_scs;
bool save_p_ws;
int save_p_ic;
@@ -2621,7 +2621,7 @@ static int ins_compl_get_exp(pos_T *ini)
break;
case CTRL_X_PATH_PATTERNS:
case CTRL_X_PATH_DEFINES:
- find_pattern_in_path(compl_pattern, compl_direction,
+ find_pattern_in_path((char_u *)compl_pattern, compl_direction,
STRLEN(compl_pattern), false, false,
((type == CTRL_X_PATH_DEFINES
&& !(compl_cont_status & CONT_SOL))
@@ -2633,14 +2633,14 @@ static int ins_compl_get_exp(pos_T *ini)
case CTRL_X_DICTIONARY:
case CTRL_X_THESAURUS:
if (thesaurus_func_complete(type)) {
- expand_by_function(type, compl_pattern);
+ expand_by_function(type, (char_u *)compl_pattern);
} else {
ins_compl_dictionaries(dict != NULL ? dict
: (type == CTRL_X_THESAURUS
? (*curbuf->b_p_tsr == NUL ? p_tsr : curbuf->b_p_tsr)
: (*curbuf->b_p_dict ==
NUL ? p_dict : curbuf->b_p_dict)),
- compl_pattern,
+ (char_u *)compl_pattern,
dict != NULL ? dict_f : 0, type == CTRL_X_THESAURUS);
}
dict = NULL;
@@ -2649,12 +2649,12 @@ static int ins_compl_get_exp(pos_T *ini)
case CTRL_X_TAGS:
// set p_ic according to p_ic, p_scs and pat for find_tags().
save_p_ic = p_ic;
- p_ic = ignorecase(compl_pattern);
+ p_ic = ignorecase((char_u *)compl_pattern);
// Find up to TAG_MANY matches. Avoids that an enormous number
// of matches is found when compl_pattern is empty
g_tag_at_cursor = true;
- if (find_tags(compl_pattern, &num_matches, &matches,
+ if (find_tags((char_u *)compl_pattern, &num_matches, &matches,
TAG_REGEXP | TAG_NAMES | TAG_NOIC | TAG_INS_COMP
| (ctrl_x_mode_not_default() ? TAG_VERBOSE : 0),
TAG_MANY, (char_u *)curbuf->b_ffname) == OK && num_matches > 0) {
@@ -2668,7 +2668,7 @@ static int ins_compl_get_exp(pos_T *ini)
if (expand_wildcards(1, &compl_pattern, &num_matches, &matches,
EW_FILE|EW_DIR|EW_ADDSLASH|EW_SILENT) == OK) {
// May change home directory back to "~".
- tilde_replace(compl_pattern, num_matches, matches);
+ tilde_replace((char_u *)compl_pattern, num_matches, matches);
#ifdef BACKSLASH_IN_FILENAME
if (curbuf->b_p_csl[0] != NUL) {
for (int i = 0; i < num_matches; i++) {
@@ -2690,7 +2690,7 @@ static int ins_compl_get_exp(pos_T *ini)
case CTRL_X_CMDLINE:
case CTRL_X_CMDLINE_CTRL_X:
- if (expand_cmdline(&compl_xp, compl_pattern,
+ if (expand_cmdline(&compl_xp, (char_u *)compl_pattern,
(int)STRLEN(compl_pattern),
&num_matches, &matches) == EXPAND_OK) {
ins_compl_add_matches(num_matches, matches, false);
@@ -2699,12 +2699,12 @@ static int ins_compl_get_exp(pos_T *ini)
case CTRL_X_FUNCTION:
case CTRL_X_OMNI:
- expand_by_function(type, compl_pattern);
+ expand_by_function(type, (char_u *)compl_pattern);
break;
case CTRL_X_SPELL:
num_matches = expand_spelling(first_match_pos.lnum,
- compl_pattern, &matches);
+ (char_u *)compl_pattern, &matches);
if (num_matches > 0) {
ins_compl_add_matches(num_matches, matches, p_ic);
}
@@ -2739,11 +2739,11 @@ static int ins_compl_get_exp(pos_T *ini)
|| (compl_cont_status & CONT_SOL)) {
found_new_match = search_for_exact_line(ins_buf, pos,
compl_direction,
- compl_pattern);
+ (char_u *)compl_pattern);
} else {
found_new_match = searchit(NULL, ins_buf, pos, NULL,
compl_direction,
- compl_pattern, 1L,
+ (char_u *)compl_pattern, 1L,
SEARCH_KEEP + SEARCH_NFMSG,
RE_LAST, NULL);
}
@@ -3337,9 +3337,9 @@ static int get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col)
compl_length = curs_col - startcol;
}
if (p_ic) {
- compl_pattern = str_foldcase(line + compl_col, compl_length, NULL, 0);
+ compl_pattern = (char *)str_foldcase(line + compl_col, compl_length, NULL, 0);
} else {
- compl_pattern = vim_strnsave(line + compl_col, (size_t)compl_length);
+ compl_pattern = (char *)vim_strnsave(line + compl_col, (size_t)compl_length);
}
} else if (compl_cont_status & CONT_ADDING) {
char_u *prefix = (char_u *)"\\<";
@@ -3352,12 +3352,12 @@ static int get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col)
prefix = (char_u *)"";
}
STRCPY(compl_pattern, prefix);
- (void)quote_meta(compl_pattern + STRLEN(prefix),
+ (void)quote_meta((char_u *)compl_pattern + STRLEN(prefix),
line + compl_col, compl_length);
} else if (--startcol < 0
|| !vim_iswordp(mb_prevptr(line, line + startcol + 1))) {
// Match any word of at least two chars
- compl_pattern = vim_strsave((char_u *)"\\<\\k\\k");
+ compl_pattern = (char *)vim_strsave((char_u *)"\\<\\k\\k");
compl_col += curs_col;
compl_length = 0;
} else {
@@ -3380,14 +3380,13 @@ static int get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col)
// xmalloc(7) is enough -- Acevedo
compl_pattern = xmalloc(7);
STRCPY(compl_pattern, "\\<");
- (void)quote_meta(compl_pattern + 2, line + compl_col, 1);
+ (void)quote_meta((char_u *)compl_pattern + 2, line + compl_col, 1);
STRCAT(compl_pattern, "\\k");
} else {
compl_pattern = xmalloc(quote_meta(NULL, line + compl_col,
compl_length) + 2);
STRCPY(compl_pattern, "\\<");
- (void)quote_meta(compl_pattern + 2, line + compl_col,
- compl_length);
+ (void)quote_meta((char_u *)compl_pattern + 2, line + compl_col, compl_length);
}
}
@@ -3405,9 +3404,9 @@ static int get_wholeline_compl_info(char_u *line, colnr_T curs_col)
compl_length = 0;
}
if (p_ic) {
- compl_pattern = str_foldcase(line + compl_col, compl_length, NULL, 0);
+ compl_pattern = (char *)str_foldcase(line + compl_col, compl_length, NULL, 0);
} else {
- compl_pattern = vim_strnsave(line + compl_col, (size_t)compl_length);
+ compl_pattern = (char *)vim_strnsave(line + compl_col, (size_t)compl_length);
}
return OK;
@@ -3434,7 +3433,7 @@ static int get_filename_compl_info(char_u *line, int startcol, colnr_T curs_col)
compl_col += startcol;
compl_length = (int)curs_col - startcol;
- compl_pattern = addstar(line + compl_col, (size_t)compl_length, EXPAND_FILES);
+ compl_pattern = (char *)addstar(line + compl_col, (size_t)compl_length, EXPAND_FILES);
return OK;
}
@@ -3443,16 +3442,15 @@ static int get_filename_compl_info(char_u *line, int startcol, colnr_T curs_col)
/// Sets the global variables: compl_col, compl_length and compl_pattern.
static int get_cmdline_compl_info(char_u *line, colnr_T curs_col)
{
- compl_pattern = vim_strnsave(line, (size_t)curs_col);
- set_cmd_context(&compl_xp, compl_pattern,
- (int)STRLEN(compl_pattern), curs_col, false);
+ compl_pattern = (char *)vim_strnsave(line, (size_t)curs_col);
+ set_cmd_context(&compl_xp, (char_u *)compl_pattern, (int)STRLEN(compl_pattern), curs_col, false);
if (compl_xp.xp_context == EXPAND_UNSUCCESSFUL
|| compl_xp.xp_context == EXPAND_NOTHING) {
// No completion possible, use an empty pattern to get a
// "pattern not found" message.
compl_col = curs_col;
} else {
- compl_col = (int)((char_u *)compl_xp.xp_pattern - compl_pattern);
+ compl_col = (int)(compl_xp.xp_pattern - compl_pattern);
}
compl_length = curs_col - compl_col;
@@ -3528,7 +3526,7 @@ static int get_userdefined_compl_info(colnr_T curs_col)
// it may have become invalid.
char_u *line = ml_get(curwin->w_cursor.lnum);
compl_length = curs_col - compl_col;
- compl_pattern = vim_strnsave(line + compl_col, (size_t)compl_length);
+ compl_pattern = (char *)vim_strnsave(line + compl_col, (size_t)compl_length);
return OK;
}
@@ -3553,7 +3551,7 @@ static int get_spell_compl_info(int startcol, colnr_T curs_col)
}
// Need to obtain "line" again, it may have become invalid.
char_u *line = ml_get(curwin->w_cursor.lnum);
- compl_pattern = vim_strnsave(line + compl_col, (size_t)compl_length);
+ compl_pattern = (char *)vim_strnsave(line + compl_col, (size_t)compl_length);
return OK;
}
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 81314f8b4a..17157ccdc2 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -1674,7 +1674,7 @@ static void nlua_add_treesitter(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL
lua_setfield(lstate, -2, "_ts_get_minimum_language_version");
}
-int nlua_expand_pat(expand_T *xp, char_u *pat, int *num_results, char_u ***results)
+int nlua_expand_pat(expand_T *xp, char_u *pat, int *num_results, char ***results)
{
lua_State *const lstate = global_lstate;
int ret = OK;
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c
index 9d1a847663..237586dc22 100644
--- a/src/nvim/mapping.c
+++ b/src/nvim/mapping.c
@@ -1230,7 +1230,7 @@ char_u *set_context_in_map_cmd(expand_T *xp, char_u *cmd, char_u *arg, bool forc
/// Find all mapping/abbreviation names that match regexp "regmatch".
/// For command line expansion of ":[un]map" and ":[un]abbrev" in all modes.
/// @return OK if matches found, FAIL otherwise.
-int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file)
+int ExpandMappings(regmatch_T *regmatch, int *num_file, char ***file)
{
mapblock_T *mp;
int hash;
@@ -1270,7 +1270,7 @@ int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file)
if (round == 1) {
count++;
} else {
- (*file)[count++] = vim_strsave(p);
+ (*file)[count++] = (char *)vim_strsave(p);
}
}
}
@@ -1293,7 +1293,7 @@ int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file)
if (round == 1) {
count++;
} else {
- (*file)[count++] = p;
+ (*file)[count++] = (char *)p;
p = NULL;
}
}
@@ -1307,22 +1307,18 @@ int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file)
}
if (round == 1) {
- *file = (char_u **)xmalloc((size_t)count * sizeof(char_u *));
+ *file = xmalloc((size_t)count * sizeof(char_u *));
}
} // for (round)
if (count > 1) {
- char_u **ptr1;
- char_u **ptr2;
- char_u **ptr3;
-
// Sort the matches
sort_strings(*file, count);
// Remove multiple entries
- ptr1 = *file;
- ptr2 = ptr1 + 1;
- ptr3 = ptr1 + count;
+ char **ptr1 = *file;
+ char **ptr2 = ptr1 + 1;
+ char **ptr3 = ptr1 + count;
while (ptr2 < ptr3) {
if (STRCMP(*ptr1, *ptr2)) {
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 1ea5e2ccdc..fa3a400a68 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -1266,12 +1266,12 @@ theend:
int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
{
int num_names;
- char_u *(names[6]);
+ char *(names[6]);
char_u *tail;
char_u *p;
int num_files;
int file_count = 0;
- char_u **files;
+ char **files;
char_u *dirp;
char_u *dir_name;
char_u *fname_res = NULL;
@@ -1308,22 +1308,22 @@ int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
if (dir_name[0] == '.' && dir_name[1] == NUL) { // check current dir
if (fname == NULL) {
- names[0] = vim_strsave((char_u *)"*.sw?");
+ names[0] = xstrdup("*.sw?");
// For Unix names starting with a dot are special. MS-Windows
// supports this too, on some file systems.
- names[1] = vim_strsave((char_u *)".*.sw?");
- names[2] = vim_strsave((char_u *)".sw?");
+ names[1] = xstrdup(".*.sw?");
+ names[2] = xstrdup(".sw?");
num_names = 3;
} else {
num_names = recov_file_names(names, fname_res, TRUE);
}
} else { // check directory dir_name
if (fname == NULL) {
- names[0] = (char_u *)concat_fnames((char *)dir_name, "*.sw?", true);
+ names[0] = concat_fnames((char *)dir_name, "*.sw?", true);
// For Unix names starting with a dot are special. MS-Windows
// supports this too, on some file systems.
- names[1] = (char_u *)concat_fnames((char *)dir_name, ".*.sw?", true);
- names[2] = (char_u *)concat_fnames((char *)dir_name, ".sw?", true);
+ names[1] = concat_fnames((char *)dir_name, ".*.sw?", true);
+ names[2] = concat_fnames((char *)dir_name, ".sw?", true);
num_names = 3;
} else {
int len = (int)STRLEN(dir_name);
@@ -1360,7 +1360,7 @@ int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
if (swapname != NULL) {
if (os_path_exists(swapname)) {
files = xmalloc(sizeof(char_u *));
- files[0] = swapname;
+ files[0] = (char *)swapname;
swapname = NULL;
num_files = 1;
}
@@ -1376,7 +1376,7 @@ int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
for (int i = 0; i < num_files; i++) {
// Do not expand wildcards, on Windows would try to expand
// "%tmp%" in "%tmp%file"
- if (path_full_compare((char *)p, (char *)files[i], true, false) & kEqualFiles) {
+ if (path_full_compare((char *)p, files[i], true, false) & kEqualFiles) {
// Remove the name from files[i]. Move further entries
// down. When the array becomes empty free it here, since
// FreeWild() won't be called below.
@@ -1394,7 +1394,7 @@ int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
if (nr > 0) {
file_count += num_files;
if (nr <= file_count) {
- *fname_out = vim_strsave(files[nr - 1 + num_files - file_count]);
+ *fname_out = vim_strsave((char_u *)files[nr - 1 + num_files - file_count]);
dirp = (char_u *)""; // stop searching
}
} else if (list) {
@@ -1415,9 +1415,9 @@ int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
// print the swap file name
msg_outnum((long)++file_count);
msg_puts(". ");
- msg_puts((const char *)path_tail((char *)files[i]));
+ msg_puts((const char *)path_tail(files[i]));
msg_putchar('\n');
- (void)swapfile_info(files[i]);
+ (void)swapfile_info((char_u *)files[i]);
}
} else {
msg_puts(_(" -- none --\n"));
@@ -1636,7 +1636,7 @@ static bool swapfile_unchanged(char *fname)
return ret;
}
-static int recov_file_names(char_u **names, char_u *path, int prepend_dot)
+static int recov_file_names(char **names, char_u *path, int prepend_dot)
FUNC_ATTR_NONNULL_ALL
{
int num_names = 0;
@@ -1644,7 +1644,7 @@ static int recov_file_names(char_u **names, char_u *path, int prepend_dot)
// May also add the file name with a dot prepended, for swap file in same
// dir as original file.
if (prepend_dot) {
- names[num_names] = (char_u *)modname((char *)path, ".sw?", true);
+ names[num_names] = modname((char *)path, ".sw?", true);
if (names[num_names] == NULL) {
return num_names;
}
@@ -1652,9 +1652,9 @@ static int recov_file_names(char_u **names, char_u *path, int prepend_dot)
}
// Form the normal swap file name pattern by appending ".sw?".
- names[num_names] = (char_u *)concat_fnames((char *)path, ".sw?", FALSE);
+ names[num_names] = concat_fnames((char *)path, ".sw?", false);
if (num_names >= 1) { // check if we have the same name twice
- char_u *p = names[num_names - 1];
+ char_u *p = (char_u *)names[num_names - 1];
int i = (int)STRLEN(names[num_names - 1]) - (int)STRLEN(names[num_names]);
if (i > 0) {
p += i; // file name has been expanded to full path
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index 018c62d604..febb66081a 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -121,7 +121,7 @@ void ex_menu(exarg_T *eap)
}
if (ascii_iswhite(*p)) {
for (i = 0; i < MENUDEPTH && !ascii_iswhite(*arg); i++) {
- pri_tab[i] = getdigits_long((char_u **)&arg, false, 0);
+ pri_tab[i] = getdigits_long(&arg, false, 0);
if (pri_tab[i] == 0) {
pri_tab[i] = 500;
}
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 0825f17ccc..cc67b0d0c1 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -1031,7 +1031,7 @@ static int execreg_lastc = NUL;
/// with a \. Lines that start with a comment "\ character are ignored.
/// @returns the concatenated line. The index of the line that should be
/// processed next is returned in idx.
-static char_u *execreg_line_continuation(char_u **lines, size_t *idx)
+static char_u *execreg_line_continuation(char **lines, size_t *idx)
{
size_t i = *idx;
assert(i > 0);
@@ -1046,7 +1046,7 @@ static char_u *execreg_line_continuation(char_u **lines, size_t *idx)
// Any line not starting with \ or "\ is the start of the
// command.
while (--i > 0) {
- p = (char_u *)skipwhite((char *)lines[i]);
+ p = (char_u *)skipwhite(lines[i]);
if (*p != '\\' && (p[0] != '"' || p[1] != '\\' || p[2] != ' ')) {
break;
}
@@ -1054,9 +1054,9 @@ static char_u *execreg_line_continuation(char_u **lines, size_t *idx)
const size_t cmd_start = i;
// join all the lines
- ga_concat(&ga, (char *)lines[cmd_start]);
+ ga_concat(&ga, lines[cmd_start]);
for (size_t j = cmd_start + 1; j <= cmd_end; j++) {
- p = (char_u *)skipwhite((char *)lines[j]);
+ p = (char_u *)skipwhite(lines[j]);
if (*p == '\\') {
// Adjust the growsize to the current length to
// speed up concatenating many lines.
@@ -1169,7 +1169,7 @@ int do_execreg(int regname, int colon, int addcr, int silent)
if (colon && i > 0) {
p = (char_u *)skipwhite((char *)str);
if (*p == '\\' || (p[0] == '"' && p[1] == '\\' && p[2] == ' ')) {
- str = execreg_line_continuation((char_u **)reg->y_array, &i);
+ str = execreg_line_continuation(reg->y_array, &i);
free_str = true;
}
}
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 0feeae84e4..12c5889703 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -6963,7 +6963,7 @@ void set_context_in_set_cmd(expand_T *xp, char_u *arg, int opt_flags)
}
}
-int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)
+int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char ***file)
{
int num_normal = 0; // Nr of matching non-term-code settings
int match;
@@ -6985,7 +6985,7 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***
if (loop == 0) {
num_normal++;
} else {
- (*file)[count++] = vim_strsave((char_u *)names[match]);
+ (*file)[count++] = xstrdup(names[match]);
}
}
}
@@ -7012,7 +7012,7 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***
if (loop == 0) {
num_normal++;
} else {
- (*file)[count++] = vim_strsave(str);
+ (*file)[count++] = (char *)vim_strsave(str);
}
}
}
@@ -7023,18 +7023,18 @@ int ExpandSettings(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***
} else {
return OK;
}
- *file = (char_u **)xmalloc((size_t)(*num_file) * sizeof(char_u *));
+ *file = xmalloc((size_t)(*num_file) * sizeof(char_u *));
}
}
return OK;
}
-void ExpandOldSetting(int *num_file, char_u ***file)
+void ExpandOldSetting(int *num_file, char ***file)
{
char_u *var = NULL;
*num_file = 0;
- *file = (char_u **)xmalloc(sizeof(char_u *));
+ *file = xmalloc(sizeof(char_u *));
/*
* For a terminal key code expand_option_idx is < 0.
@@ -7069,7 +7069,7 @@ void ExpandOldSetting(int *num_file, char_u ***file)
}
#endif
- *file[0] = buf;
+ *file[0] = (char *)buf;
*num_file = 1;
}
@@ -7881,16 +7881,15 @@ static bool briopt_check(win_T *wp)
bool bri_sbr = false;
int bri_list = 0;
- char_u *p = wp->w_p_briopt;
- while (*p != NUL)
- {
+ char *p = (char *)wp->w_p_briopt;
+ while (*p != NUL) {
if (STRNCMP(p, "shift:", 6) == 0
&& ((p[6] == '-' && ascii_isdigit(p[7])) || ascii_isdigit(p[6]))) {
p += 6;
- bri_shift = getdigits_int((char **)&p, true, 0);
+ bri_shift = getdigits_int(&p, true, 0);
} else if (STRNCMP(p, "min:", 4) == 0 && ascii_isdigit(p[4])) {
p += 4;
- bri_min = getdigits_int((char **)&p, true, 0);
+ bri_min = getdigits_int(&p, true, 0);
} else if (STRNCMP(p, "sbr", 3) == 0) {
p += 3;
bri_sbr = true;
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 9283ea2e42..8f2018c1f4 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -47,30 +47,30 @@ typedef struct {
# include "os/shell.c.generated.h"
#endif
-static void save_patterns(int num_pat, char_u **pat, int *num_file, char_u ***file)
+static void save_patterns(int num_pat, char **pat, int *num_file, char ***file)
{
*file = xmalloc((size_t)num_pat * sizeof(char_u *));
for (int i = 0; i < num_pat; i++) {
- char_u *s = vim_strsave(pat[i]);
+ char_u *s = vim_strsave((char_u *)pat[i]);
// Be compatible with expand_filename(): halve the number of
// backslashes.
backslash_halve(s);
- (*file)[i] = s;
+ (*file)[i] = (char *)s;
}
*num_file = num_pat;
}
-static bool have_wildcard(int num, char_u **file)
+static bool have_wildcard(int num, char **file)
{
for (int i = 0; i < num; i++) {
- if (path_has_wildcard(file[i])) {
+ if (path_has_wildcard((char_u *)file[i])) {
return true;
}
}
return false;
}
-static bool have_dollars(int num, char_u **file)
+static bool have_dollars(int num, char **file)
{
for (int i = 0; i < num; i++) {
if (vim_strchr((char *)file[i], '$') != NULL) {
@@ -98,7 +98,7 @@ static bool have_dollars(int num, char_u **file)
/// copied into *file.
///
/// @returns OK for success or FAIL for error.
-int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags)
+int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, int flags)
FUNC_ATTR_NONNULL_ARG(3)
FUNC_ATTR_NONNULL_ARG(4)
{
@@ -151,7 +151,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
// Don't allow the use of backticks in secure.
if (secure) {
for (i = 0; i < num_pat; i++) {
- if (vim_strchr((char *)pat[i], '`') != NULL
+ if (vim_strchr(pat[i], '`') != NULL
&& (check_secure())) {
return FAIL;
}
@@ -297,7 +297,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
}
// Copy one character.
- *p++ = pat[i][j];
+ *p++ = (char_u)pat[i][j];
}
*p = NUL;
}
@@ -471,7 +471,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
// Isolate the individual file names.
p = buffer;
for (i = 0; i < *num_file; i++) {
- (*file)[i] = p;
+ (*file)[i] = (char *)p;
// Space or NL separates
if (shell_style == STYLE_ECHO || shell_style == STYLE_BT
|| shell_style == STYLE_VIMGLOB) {
@@ -496,19 +496,19 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
// Move the file names to allocated memory.
for (j = 0, i = 0; i < *num_file; i++) {
// Require the files to exist. Helps when using /bin/sh
- if (!(flags & EW_NOTFOUND) && !os_path_exists((*file)[i])) {
+ if (!(flags & EW_NOTFOUND) && !os_path_exists((char_u *)(*file)[i])) {
continue;
}
// check if this entry should be included
- dir = (os_isdir((*file)[i]));
+ dir = (os_isdir((char_u *)(*file)[i]));
if ((dir && !(flags & EW_DIR)) || (!dir && !(flags & EW_FILE))) {
continue;
}
// Skip files that are not executable if we check for that.
if (!dir && (flags & EW_EXEC)
- && !os_can_exe((char *)(*file)[i], NULL, !(flags & EW_SHELLCMD))) {
+ && !os_can_exe((*file)[i], NULL, !(flags & EW_SHELLCMD))) {
continue;
}
@@ -517,7 +517,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
if (dir) {
add_pathsep((char *)p); // add '/' to a directory name
}
- (*file)[j++] = p;
+ (*file)[j++] = (char *)p;
}
xfree(buffer);
*num_file = j;
diff --git a/src/nvim/path.c b/src/nvim/path.c
index b22c0a18bd..a0b09bcec2 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1211,7 +1211,7 @@ static bool has_special_wildchar(char_u *p)
/// If FAIL is returned, *num_file and *file are either
/// unchanged or *num_file is set to 0 and *file is set
/// to NULL or points to "".
-int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file, int flags)
+int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, int flags)
{
garray_T ga;
char_u *p;
@@ -1240,8 +1240,8 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***fil
* For `=expr` do use the internal function.
*/
for (int i = 0; i < num_pat; i++) {
- if (has_special_wildchar(pat[i])
- && !(vim_backtick(pat[i]) && pat[i][1] == '=')) {
+ if (has_special_wildchar((char_u *)pat[i])
+ && !(vim_backtick((char_u *)pat[i]) && pat[i][1] == '=')) {
return os_expand_wildcards(num_pat, pat, num_file, file, flags);
}
}
@@ -1256,13 +1256,13 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***fil
for (int i = 0; i < num_pat; ++i) {
add_pat = -1;
- p = pat[i];
+ p = (char_u *)pat[i];
if (vim_backtick(p)) {
add_pat = expand_backtick(&ga, p, flags);
if (add_pat == -1) {
recursive = false;
- FreeWild(ga.ga_len, (char_u **)ga.ga_data);
+ FreeWild(ga.ga_len, ga.ga_data);
*num_file = 0;
*file = NULL;
return FAIL;
@@ -1272,7 +1272,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***fil
if ((has_env_var(p) && !(flags & EW_NOTENV)) || *p == '~') {
p = expand_env_save_opt(p, true);
if (p == NULL) {
- p = pat[i];
+ p = (char_u *)pat[i];
}
#ifdef UNIX
/*
@@ -1338,13 +1338,13 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***fil
if (did_expand_in_path && !GA_EMPTY(&ga) && (flags & EW_PATH)) {
uniquefy_paths(&ga, p);
}
- if (p != pat[i]) {
+ if (p != (char_u *)pat[i]) {
xfree(p);
}
}
*num_file = ga.ga_len;
- *file = (ga.ga_data != NULL) ? (char_u **)ga.ga_data : NULL;
+ *file = (ga.ga_data != NULL) ? ga.ga_data : NULL;
recursive = false;
@@ -1352,7 +1352,7 @@ int gen_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***fil
}
/// Free the list of files returned by expand_wildcards() or other expansion functions.
-void FreeWild(int count, char_u **files)
+void FreeWild(int count, char **files)
{
if (count <= 0 || files == NULL) {
return;
@@ -2123,21 +2123,20 @@ char_u *path_shorten_fname(char_u *full_path, char_u *dir_name)
/// If FAIL is returned, *num_file and *file are either
/// unchanged or *num_file is set to 0 and *file is set
/// to NULL or points to "".
-int expand_wildcards_eval(char_u **pat, int *num_file, char_u ***file, int flags)
+int expand_wildcards_eval(char_u **pat, int *num_file, char ***file, int flags)
{
int ret = FAIL;
char_u *eval_pat = NULL;
- char_u *exp_pat = *pat;
+ char *exp_pat = (char *)(*pat);
char *ignored_msg;
size_t usedlen;
if (*exp_pat == '%' || *exp_pat == '#' || *exp_pat == '<') {
- ++emsg_off;
- eval_pat = eval_vars(exp_pat, exp_pat, &usedlen,
- NULL, &ignored_msg, NULL);
- --emsg_off;
+ emsg_off++;
+ eval_pat = eval_vars((char_u *)exp_pat, (char_u *)exp_pat, &usedlen, NULL, &ignored_msg, NULL);
+ emsg_off--;
if (eval_pat != NULL) {
- exp_pat = concat_str(eval_pat, exp_pat + usedlen);
+ exp_pat = (char *)concat_str(eval_pat, (char_u *)exp_pat + usedlen);
}
}
@@ -2167,7 +2166,7 @@ int expand_wildcards_eval(char_u **pat, int *num_file, char_u ***file, int flags
/// If FAIL is returned, *num_file and *file are either
/// unchanged or *num_file is set to 0 and *file is set to
/// NULL or points to "".
-int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files, int flags)
+int expand_wildcards(int num_pat, char **pat, int *num_files, char ***files, int flags)
{
int retval;
int i, j;
@@ -2190,10 +2189,10 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files,
// check all files in (*files)[]
assert(*num_files == 0 || *files != NULL);
for (i = 0; i < *num_files; i++) {
- ffname = (char_u *)FullName_save((char *)(*files)[i], false);
+ ffname = (char_u *)FullName_save((*files)[i], false);
assert((*files)[i] != NULL);
assert(ffname != NULL);
- if (match_file_list(p_wig, (*files)[i], ffname)) {
+ if (match_file_list(p_wig, (char_u *)(*files)[i], ffname)) {
// remove this matching file from the list
xfree((*files)[i]);
for (j = i; j + 1 < *num_files; j++) {
@@ -2213,15 +2212,15 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files,
if (*num_files > 1) {
non_suf_match = 0;
for (i = 0; i < *num_files; i++) {
- if (!match_suffix((*files)[i])) {
+ if (!match_suffix((char_u *)(*files)[i])) {
//
// Move the name without matching suffix to the front of the list.
//
- p = (*files)[i];
+ p = (char_u *)(*files)[i];
for (j = i; j > non_suf_match; j--) {
(*files)[j] = (*files)[j - 1];
}
- (*files)[non_suf_match++] = p;
+ (*files)[non_suf_match++] = (char *)p;
}
}
}
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index bdfaa11935..03d81d586e 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -5439,7 +5439,7 @@ static int vgr_process_args(exarg_T *eap, vgr_args_T *args)
}
// Parse the list of arguments, wildcards have already been expanded.
- if (get_arglist_exp((char_u *)p, &args->fcount, (char_u ***)&args->fnames, true) == FAIL) {
+ if (get_arglist_exp((char_u *)p, &args->fcount, &args->fnames, true) == FAIL) {
return FAIL;
}
if (args->fcount == 0) {
@@ -5615,12 +5615,12 @@ void ex_vimgrep(exarg_T *eap)
int status = vgr_process_files(wp, qi, &args, &redraw_for_dummy, &first_match_buf, &target_dir);
if (status != OK) {
- FreeWild(args.fcount, (char_u **)args.fnames);
+ FreeWild(args.fcount, args.fnames);
decr_quickfix_busy();
goto theend;
}
- FreeWild(args.fcount, (char_u **)args.fnames);
+ FreeWild(args.fcount, args.fnames);
qf_list_T *qfl = qf_get_curlist(qi);
qfl->qf_nonevalid = false;
@@ -7165,8 +7165,7 @@ static void hgr_search_files_in_dir(qf_list_T *qfl, char *dirname, regmatch_T *p
// Find all "*.txt" and "*.??x" files in the "doc" directory.
add_pathsep(dirname);
STRCAT(dirname, "doc/*.\\(txt\\|??x\\)"); // NOLINT
- if (gen_expand_wildcards(1, (char_u **)&dirname, &fcount,
- (char_u ***)&fnames, EW_FILE|EW_SILENT) == OK
+ if (gen_expand_wildcards(1, &dirname, &fcount, &fnames, EW_FILE|EW_SILENT) == OK
&& fcount > 0) {
for (int fi = 0; fi < fcount && !got_int; fi++) {
// Skip files for a different language.
@@ -7180,7 +7179,7 @@ static void hgr_search_files_in_dir(qf_list_T *qfl, char *dirname, regmatch_T *p
hgr_search_file(qfl, fnames[fi], p_regmatch);
}
- FreeWild(fcount, (char_u **)fnames);
+ FreeWild(fcount, fnames);
}
}
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index 2b42af5750..c2a9c90dda 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -176,12 +176,10 @@ static int backslash_trans(int c)
return c;
}
-/*
- * Check for a character class name "[:name:]". "pp" points to the '['.
- * Returns one of the CLASS_ items. CLASS_NONE means that no item was
- * recognized. Otherwise "pp" is advanced to after the item.
- */
-static int get_char_class(char_u **pp)
+/// Check for a character class name "[:name:]". "pp" points to the '['.
+/// Returns one of the CLASS_ items. CLASS_NONE means that no item was
+/// recognized. Otherwise "pp" is advanced to after the item.
+static int get_char_class(char **pp)
{
static const char *(class_names[]) =
{
@@ -306,7 +304,7 @@ static void init_class_tab(void)
// Global work variables for vim_regcomp().
-static char_u *regparse; ///< Input-scan pointer.
+static char *regparse; ///< Input-scan pointer.
static int regnpar; ///< () count.
static bool wants_nfa; ///< regex should use NFA engine
static int regnzpar; ///< \z() count.
@@ -395,11 +393,11 @@ int re_multiline(const regprog_T *prog)
* Returns a character representing the class. Zero means that no item was
* recognized. Otherwise "pp" is advanced to after the item.
*/
-static int get_equi_class(char_u **pp)
+static int get_equi_class(char **pp)
{
int c;
int l = 1;
- char_u *p = *pp;
+ char_u *p = (char_u *)(*pp);
if (p[1] == '=' && p[2] != NUL) {
l = utfc_ptr2len((char *)p + 2);
@@ -418,11 +416,11 @@ static int get_equi_class(char_u **pp)
* "pp" is advanced to after the item.
* Currently only single characters are recognized!
*/
-static int get_coll_element(char_u **pp)
+static int get_coll_element(char **pp)
{
int c;
int l = 1;
- char_u *p = *pp;
+ char_u *p = (char_u *)(*pp);
if (p[0] != NUL && p[1] == '.' && p[2] != NUL) {
l = utfc_ptr2len((char *)p + 2);
@@ -442,12 +440,10 @@ static void get_cpo_flags(void)
reg_cpo_lit = vim_strchr(p_cpo, CPO_LITERAL) != NULL;
}
-/*
- * Skip over a "[]" range.
- * "p" must point to the character after the '['.
- * The returned pointer is on the matching ']', or the terminating NUL.
- */
-static char_u *skip_anyof(char_u *p)
+/// Skip over a "[]" range.
+/// "p" must point to the character after the '['.
+/// The returned pointer is on the matching ']', or the terminating NUL.
+static char_u *skip_anyof(char *p)
{
int l;
@@ -458,7 +454,7 @@ static char_u *skip_anyof(char_u *p)
p++;
}
while (*p != NUL && *p != ']') {
- if ((l = utfc_ptr2len((char *)p)) > 1) {
+ if ((l = utfc_ptr2len(p)) > 1) {
p += l;
} else if (*p == '-') {
p++;
@@ -482,7 +478,7 @@ static char_u *skip_anyof(char_u *p)
}
}
- return p;
+ return (char_u *)p;
}
/*
@@ -512,7 +508,7 @@ char_u *skip_regexp(char_u *startp, int dirc, int magic, char_u **newp)
}
if ((p[0] == '[' && mymagic >= MAGIC_ON)
|| (p[0] == '\\' && p[1] == '[' && mymagic <= MAGIC_OFF)) {
- p = skip_anyof(p + 1);
+ p = skip_anyof((char *)p + 1);
if (p[0] == NUL) {
break;
}
@@ -547,7 +543,7 @@ static int prev_at_start; // True when on the second character
*/
static void initchr(char_u *str)
{
- regparse = str;
+ regparse = (char *)str;
prevchr_len = 0;
curchr = prevprevchr = prevchr = nextchr = -1;
at_start = true;
@@ -560,7 +556,7 @@ static void initchr(char_u *str)
*/
static void save_parse_state(parse_state_T *ps)
{
- ps->regparse = regparse;
+ ps->regparse = (char_u *)regparse;
ps->prevchr_len = prevchr_len;
ps->curchr = curchr;
ps->prevchr = prevchr;
@@ -576,7 +572,7 @@ static void save_parse_state(parse_state_T *ps)
*/
static void restore_parse_state(parse_state_T *ps)
{
- regparse = ps->regparse;
+ regparse = (char *)ps->regparse;
prevchr_len = ps->prevchr_len;
curchr = ps->curchr;
prevchr = ps->prevchr;
@@ -598,7 +594,7 @@ static int peekchr(void)
return curchr;
}
- switch (curchr = regparse[0]) {
+ switch (curchr = (uint8_t)regparse[0]) {
case '.':
case '[':
case '~':
@@ -669,7 +665,7 @@ static int peekchr(void)
// '$' is only magic as the very last char and if it's in front of
// either "\|", "\)", "\&", or "\n"
if (reg_magic >= MAGIC_OFF) {
- char_u *p = regparse + 1;
+ char_u *p = (char_u *)regparse + 1;
bool is_magic_all = (reg_magic == MAGIC_ALL);
// ignore \c \C \m \M \v \V and \Z after '$'
@@ -696,7 +692,7 @@ static int peekchr(void)
}
break;
case '\\': {
- int c = regparse[1];
+ int c = (uint8_t)regparse[1];
if (c == NUL) {
curchr = '\\'; // trailing '\'
@@ -725,13 +721,13 @@ static int peekchr(void)
} else {
// Next character can never be (made) magic?
// Then backslashing it won't do anything.
- curchr = utf_ptr2char((char *)regparse + 1);
+ curchr = utf_ptr2char(regparse + 1);
}
break;
}
default:
- curchr = utf_ptr2char((char *)regparse);
+ curchr = utf_ptr2char(regparse);
}
return curchr;
@@ -750,7 +746,7 @@ static void skipchr(void)
}
if (regparse[prevchr_len] != NUL) {
// Exclude composing chars that utfc_ptr2len does include.
- prevchr_len += utf_ptr2len((char *)regparse + prevchr_len);
+ prevchr_len += utf_ptr2len(regparse + prevchr_len);
}
regparse += prevchr_len;
prev_at_start = at_start;
@@ -820,8 +816,8 @@ static int64_t gethexchrs(int maxinputlen)
int c;
int i;
- for (i = 0; i < maxinputlen; ++i) {
- c = regparse[0];
+ for (i = 0; i < maxinputlen; i++) {
+ c = (uint8_t)regparse[0];
if (!ascii_isxdigit(c)) {
break;
}
@@ -846,8 +842,8 @@ static int64_t getdecchrs(void)
int c;
int i;
- for (i = 0;; ++i) {
- c = regparse[0];
+ for (i = 0;; i++) {
+ c = (uint8_t)regparse[0];
if (c < '0' || c > '9') {
break;
}
@@ -878,7 +874,7 @@ static int64_t getoctchrs(void)
int i;
for (i = 0; i < 3 && nr < 040; i++) { // -V536
- c = regparse[0];
+ c = (uint8_t)regparse[0];
if (c < '0' || c > '7') {
break;
}
@@ -910,7 +906,7 @@ static int read_limits(long *minval, long *maxval)
regparse++;
reverse = true;
}
- first_char = regparse;
+ first_char = (char_u *)regparse;
*minval = getdigits_long(&regparse, false, 0);
if (*regparse == ',') { // There is a comma.
if (ascii_isdigit(*++regparse)) {
diff --git a/src/nvim/regexp_bt.c b/src/nvim/regexp_bt.c
index 5bb17e0939..fff5ae9b7f 100644
--- a/src/nvim/regexp_bt.c
+++ b/src/nvim/regexp_bt.c
@@ -1689,7 +1689,7 @@ static int seen_endbrace(int refnum)
// Trick: check if "@<=" or "@<!" follows, in which case
// the \1 can appear before the referenced match.
- for (p = regparse; *p != NUL; p++) {
+ for (p = (char_u *)regparse; *p != NUL; p++) {
if (p[0] == '@' && p[1] == '<' && (p[2] == '!' || p[2] == '=')) {
break;
}
@@ -2469,7 +2469,7 @@ do_multibyte:
// Need to get composing character too.
for (;;) {
l = utf_ptr2len((char *)regparse);
- if (!utf_composinglike(regparse, regparse + l)) {
+ if (!utf_composinglike((char_u *)regparse, (char_u *)regparse + l)) {
break;
}
regmbc(utf_ptr2char((char *)regparse));
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index c1cc877d06..1a5c250664 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -1807,7 +1807,7 @@ static int nfa_regatom(void)
int got_coll_char;
char_u *p;
char_u *endp;
- char_u *old_regparse = regparse;
+ char_u *old_regparse = (char_u *)regparse;
int extra = 0;
int emit_range;
int negated;
@@ -1905,7 +1905,7 @@ static int nfa_regatom(void)
// When '.' is followed by a composing char ignore the dot, so that
// the composing char is matched here.
if (c == Magic('.') && utf_iscomposing(peekchr())) {
- old_regparse = regparse;
+ old_regparse = (char_u *)regparse;
c = getchr();
goto nfa_do_multibyte;
}
@@ -2226,16 +2226,15 @@ collection:
* - ranges, two characters followed by NFA_RANGE.
*/
- p = regparse;
- endp = skip_anyof(p);
+ p = (char_u *)regparse;
+ endp = skip_anyof((char *)p);
if (*endp == ']') {
/*
* Try to reverse engineer character classes. For example,
* recognize that [0-9] stands for \d and [A-Za-z_] for \h,
* and perform the necessary substitutions in the NFA.
*/
- int result = nfa_recognize_char_class(regparse, endp,
- extra == NFA_ADD_NL);
+ int result = nfa_recognize_char_class((char_u *)regparse, endp, extra == NFA_ADD_NL);
if (result != FAIL) {
if (result >= NFA_FIRST_NL && result <= NFA_LAST_NL) {
EMIT(result - NFA_ADD_NL);
@@ -2244,7 +2243,7 @@ collection:
} else {
EMIT(result);
}
- regparse = endp;
+ regparse = (char *)endp;
MB_PTR_ADV(regparse);
return OK;
}
@@ -2269,7 +2268,7 @@ collection:
}
// Emit the OR branches for each character in the []
emit_range = false;
- while (regparse < endp) {
+ while ((char_u *)regparse < endp) {
int oldstartc = startc;
startc = -1;
got_coll_char = false;
@@ -2376,7 +2375,7 @@ collection:
// accepts "\t", "\e", etc., but only when the 'l' flag in
// 'cpoptions' is not included.
if (*regparse == '\\'
- && regparse + 1 <= endp
+ && (char_u *)regparse + 1 <= endp
&& (vim_strchr(REGEXP_INRANGE, regparse[1]) != NULL
|| (!reg_cpo_lit
&& vim_strchr(REGEXP_ABBR, regparse[1])
@@ -2479,7 +2478,7 @@ collection:
}
// skip the trailing ]
- regparse = endp;
+ regparse = (char *)endp;
MB_PTR_ADV(regparse);
// Mark end of the collection.
@@ -2531,7 +2530,7 @@ nfa_do_multibyte:
c = utf_ptr2char((char *)old_regparse + i);
}
EMIT(NFA_COMPOSING);
- regparse = old_regparse + plen;
+ regparse = (char *)old_regparse + plen;
} else {
c = no_Magic(c);
EMIT(c);
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index 045cee2439..5d28d624fe 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -74,14 +74,14 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
{
char_u *tail;
int num_files;
- char_u **files;
+ char **files;
int i;
bool did_one = false;
// Make a copy of 'runtimepath'. Invoking the callback may change the
// value.
char_u *rtp_copy = vim_strsave(path);
- char_u *buf = xmallocz(MAXPATHL);
+ char *buf = xmallocz(MAXPATHL);
{
if (p_verbose > 10 && name != NULL) {
verbose_enter();
@@ -93,7 +93,7 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
char_u *rtp = rtp_copy;
while (*rtp != NUL && ((flags & DIP_ALL) || !did_one)) {
// Copy the path from 'runtimepath' to buf[].
- copy_option_part((char **)&rtp, (char *)buf, MAXPATHL, ",");
+ copy_option_part((char **)&rtp, buf, MAXPATHL, ",");
size_t buflen = STRLEN(buf);
// Skip after or non-after directories.
@@ -107,18 +107,19 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
}
if (name == NULL) {
- (*callback)((char *)buf, cookie);
+ (*callback)(buf, cookie);
did_one = true;
} else if (buflen + STRLEN(name) + 2 < MAXPATHL) {
- add_pathsep((char *)buf);
- tail = buf + STRLEN(buf);
+ add_pathsep(buf);
+ tail = (char_u *)buf + STRLEN(buf);
// Loop over all patterns in "name"
char_u *np = (char_u *)name;
while (*np != NUL && ((flags & DIP_ALL) || !did_one)) {
// Append the pattern from "name" to buf[].
- assert(MAXPATHL >= (tail - buf));
- copy_option_part((char **)&np, (char *)tail, (size_t)(MAXPATHL - (tail - buf)), "\t ");
+ assert(MAXPATHL >= (tail - (char_u *)buf));
+ copy_option_part((char **)&np, (char *)tail, (size_t)(MAXPATHL - (tail - (char_u *)buf)),
+ "\t ");
if (p_verbose > 10) {
verbose_enter();
@@ -132,7 +133,7 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
// Expand wildcards, invoke the callback for each match.
if (gen_expand_wildcards(1, &buf, &num_files, &files, ew_flags) == OK) {
for (i = 0; i < num_files; i++) {
- (*callback)((char *)files[i], cookie);
+ (*callback)(files[i], cookie);
did_one = true;
if (!(flags & DIP_ALL)) {
break;
@@ -211,7 +212,7 @@ int do_in_cached_path(char_u *name, int flags, DoInRuntimepathCB callback, void
{
char_u *tail;
int num_files;
- char_u **files;
+ char **files;
int i;
bool did_one = false;
@@ -263,10 +264,10 @@ int do_in_cached_path(char_u *name, int flags, DoInRuntimepathCB callback, void
| (flags & DIP_DIRFILE) ? (EW_DIR|EW_FILE) : 0;
// Expand wildcards, invoke the callback for each match.
- char_u *(pat[]) = { buf };
+ char *(pat[]) = { (char *)buf };
if (gen_expand_wildcards(1, pat, &num_files, &files, ew_flags) == OK) {
for (i = 0; i < num_files; i++) {
- (*callback)((char *)files[i], cookie);
+ (*callback)(files[i], cookie);
did_one = true;
if (!(flags & DIP_ALL)) {
break;
@@ -458,11 +459,11 @@ static void expand_rtp_entry(RuntimeSearchPath *search_path, Map(String, handle_
}
int num_files;
- char_u **files;
- char_u *(pat[]) = { (char_u *)entry };
+ char **files;
+ char *(pat[]) = { entry };
if (gen_expand_wildcards(1, pat, &num_files, &files, EW_DIR) == OK) {
for (int i = 0; i < num_files; i++) {
- push_path(search_path, rtp_used, (char *)files[i], after);
+ push_path(search_path, rtp_used, files[i], after);
}
FreeWild(num_files, files);
}
@@ -488,7 +489,7 @@ static void expand_pack_entry(RuntimeSearchPath *search_path, Map(String, handle
}
}
-static bool path_is_after(char_u *buf, size_t buflen)
+static bool path_is_after(char *buf, size_t buflen)
{
// NOTE: we only consider dirs exactly matching "after" to be an AFTER dir.
// vim8 considers all dirs like "foo/bar_after", "Xafter" etc, as an
@@ -525,7 +526,7 @@ RuntimeSearchPath runtime_search_path_build(void)
copy_option_part(&rtp_entry, (char *)buf, MAXPATHL, ",");
size_t buflen = STRLEN(buf);
- if (path_is_after(buf, buflen)) {
+ if (path_is_after((char *)buf, buflen)) {
rtp_entry = cur_entry;
break;
}
@@ -557,7 +558,7 @@ RuntimeSearchPath runtime_search_path_build(void)
// "after" dirs in rtp
for (; *rtp_entry != NUL;) {
copy_option_part(&rtp_entry, (char *)buf, MAXPATHL, ",");
- expand_rtp_entry(&search_path, &rtp_used, (char *)buf, path_is_after(buf, STRLEN(buf)));
+ expand_rtp_entry(&search_path, &rtp_used, (char *)buf, path_is_after((char *)buf, STRLEN(buf)));
}
// strings are not owned
@@ -640,14 +641,14 @@ int source_in_path(char_u *path, char_u *name, int flags)
// Expand wildcards in "pat" and invoke do_source()/nlua_exec_file()
// for each match.
-static void source_all_matches(char_u *pat)
+static void source_all_matches(char *pat)
{
int num_files;
- char_u **files;
+ char **files;
if (gen_expand_wildcards(1, &pat, &num_files, &files, EW_FILE) == OK) {
for (int i = 0; i < num_files; i++) {
- (void)do_source((char *)files[i], false, DOSO_NONE);
+ (void)do_source(files[i], false, DOSO_NONE);
}
FreeWild(num_files, files);
}
@@ -811,9 +812,9 @@ static int load_pack_plugin(bool opt, char_u *fname)
char_u *pat = xmallocz(len);
vim_snprintf((char *)pat, len, "%s/plugin/**/*.vim", ffname); // NOLINT
- source_all_matches(pat);
+ source_all_matches((char *)pat);
vim_snprintf((char *)pat, len, "%s/plugin/**/*.lua", ffname); // NOLINT
- source_all_matches(pat);
+ source_all_matches((char *)pat);
char_u *cmd = vim_strsave((char_u *)"g:did_load_filetypes");
@@ -822,9 +823,9 @@ static int load_pack_plugin(bool opt, char_u *fname)
if (opt && eval_to_number((char *)cmd) > 0) {
do_cmdline_cmd("augroup filetypedetect");
vim_snprintf((char *)pat, len, ftpat, ffname);
- source_all_matches(pat);
+ source_all_matches((char *)pat);
vim_snprintf((char *)pat, len, "%s/ftdetect/*.lua", ffname); // NOLINT
- source_all_matches(pat);
+ source_all_matches((char *)pat);
do_cmdline_cmd("augroup END");
}
xfree(cmd);
@@ -886,8 +887,8 @@ void add_pack_start_dirs(void)
static bool pack_has_entries(char_u *buf)
{
int num_files;
- char_u **files;
- char_u *(pat[]) = { buf };
+ char **files;
+ char *(pat[]) = { (char *)buf };
if (gen_expand_wildcards(1, pat, &num_files, &files, EW_DIR) == OK) {
FreeWild(num_files, files);
}
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 5e20b35c5e..80f6f75fea 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -4761,8 +4761,7 @@ static int skip_status_match_char(expand_T *xp, char_u *s)
/// If inversion is possible we use it. Else '=' characters are used.
///
/// @param matches list of matches
-void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, int match,
- int showtail)
+void win_redr_status_matches(expand_T *xp, int num_matches, char **matches, int match, int showtail)
{
#define L_MATCH(m) (showtail ? sm_gettail(matches[m], false) : matches[m])
int row;
@@ -4793,7 +4792,7 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
highlight = false;
}
// count 1 for the ending ">"
- clen = status_match_len(xp, L_MATCH(match)) + 3;
+ clen = status_match_len(xp, (char_u *)L_MATCH(match)) + 3;
if (match == 0) {
first_match = 0;
} else if (match < first_match) {
@@ -4802,8 +4801,8 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
add_left = true;
} else {
// check if match fits on the screen
- for (i = first_match; i < match; ++i) {
- clen += status_match_len(xp, L_MATCH(i)) + 2;
+ for (i = first_match; i < match; i++) {
+ clen += status_match_len(xp, (char_u *)L_MATCH(i)) + 2;
}
if (first_match > 0) {
clen += 2;
@@ -4813,8 +4812,8 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
first_match = match;
// if showing the last match, we can add some on the left
clen = 2;
- for (i = match; i < num_matches; ++i) {
- clen += status_match_len(xp, L_MATCH(i)) + 2;
+ for (i = match; i < num_matches; i++) {
+ clen += status_match_len(xp, (char_u *)L_MATCH(i)) + 2;
if ((long)clen >= Columns) {
break;
}
@@ -4826,7 +4825,7 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
}
if (add_left) {
while (first_match > 0) {
- clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2;
+ clen += status_match_len(xp, (char_u *)L_MATCH(first_match - 1)) + 2;
if ((long)clen >= Columns) {
break;
}
@@ -4846,13 +4845,13 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
clen = len;
i = first_match;
- while (clen + status_match_len(xp, L_MATCH(i)) + 2 < Columns) {
+ while (clen + status_match_len(xp, (char_u *)L_MATCH(i)) + 2 < Columns) {
if (i == match) {
selstart = buf + len;
selstart_col = clen;
}
- s = L_MATCH(i);
+ s = (char_u *)L_MATCH(i);
// Check for menu separators - replace with '|'
emenu = (xp->xp_context == EXPAND_MENUS
|| xp->xp_context == EXPAND_MENUNAMES);
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 1e2c124392..ceb35af4b8 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -7319,7 +7319,7 @@ void spell_expand_check_cap(colnr_T col)
// Used for Insert mode completion CTRL-X ?.
// Returns the number of matches. The matches are in "matchp[]", array of
// allocated strings.
-int expand_spelling(linenr_T lnum, char_u *pat, char_u ***matchp)
+int expand_spelling(linenr_T lnum, char_u *pat, char ***matchp)
{
garray_T ga;
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index 7fb3c90eee..9f21e24d4c 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -1862,7 +1862,7 @@ static long compress_added = 500000; // word count
// Sets "sps_flags".
int spell_check_msm(void)
{
- char_u *p = p_msm;
+ char *p = (char *)p_msm;
long start = 0;
long incr = 0;
long added = 0;
@@ -4879,7 +4879,7 @@ static int put_node(FILE *fd, wordnode_T *node, int idx, int regionmask, bool pr
void ex_mkspell(exarg_T *eap)
{
int fcount;
- char_u **fnames;
+ char **fnames;
char_u *arg = (char_u *)eap->arg;
bool ascii = false;
@@ -5270,11 +5270,11 @@ theend:
/// @param ascii -ascii argument given
/// @param over_write overwrite existing output file
/// @param added_word invoked through "zg"
-static void mkspell(int fcount, char_u **fnames, bool ascii, bool over_write, bool added_word)
+static void mkspell(int fcount, char **fnames, bool ascii, bool over_write, bool added_word)
{
char_u *fname = NULL;
char_u *wfname;
- char_u **innames;
+ char **innames;
int incount;
afffile_T *(afile[MAXREGIONS]);
int i;
@@ -5411,7 +5411,7 @@ static void mkspell(int fcount, char_u **fnames, bool ascii, bool over_write, bo
} else {
// No .aff file, try reading the file as a word list. Store
// the words in the trees.
- if (spell_read_wordfile(&spin, innames[i]) == FAIL) {
+ if (spell_read_wordfile(&spin, (char_u *)innames[i]) == FAIL) {
error = true;
}
}
@@ -5522,7 +5522,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
FILE *fd = NULL;
buf_T *buf = NULL;
bool new_spf = false;
- char_u *fname;
+ char *fname;
char_u *fnamebuf = NULL;
char_u line[MAXWLEN * 2];
long fpos, fpos_next = 0;
@@ -5541,7 +5541,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
return;
}
}
- fname = int_wordlist;
+ fname = (char *)int_wordlist;
} else {
// If 'spellfile' isn't set figure out a good default value.
if (*curwin->w_s->b_p_spf == NUL) {
@@ -5578,13 +5578,13 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
return;
}
- fname = fnamebuf;
+ fname = (char *)fnamebuf;
}
if (what == SPELL_ADD_BAD || undo) {
// When the word appears as good word we need to remove that one,
// since its flags sort before the one with WF_BANNED.
- fd = os_fopen((char *)fname, "r");
+ fd = os_fopen(fname, "r");
if (fd != NULL) {
while (!vim_fgets(line, MAXWLEN * 2, fd)) {
fpos = fpos_next;
@@ -5598,14 +5598,14 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
// the start of the line. Mixing reading and writing
// doesn't work for all systems, close the file first.
fclose(fd);
- fd = os_fopen((char *)fname, "r+");
+ fd = os_fopen(fname, "r+");
if (fd == NULL) {
break;
}
if (fseek(fd, fpos, SEEK_SET) == 0) {
fputc('#', fd);
if (undo) {
- home_replace(NULL, (char *)fname, (char *)NameBuff, MAXPATHL, true);
+ home_replace(NULL, fname, (char *)NameBuff, MAXPATHL, true);
smsg(_("Word '%.*s' removed from %s"), len, word, NameBuff);
}
}
@@ -5622,7 +5622,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
}
if (!undo) {
- fd = os_fopen((char *)fname, "a");
+ fd = os_fopen(fname, "a");
if (fd == NULL && new_spf) {
char_u *p;
@@ -5630,16 +5630,16 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
// file. We may need to create the "spell" directory first. We
// already checked the runtime directory is writable in
// init_spellfile().
- if (!dir_of_file_exists(fname)
- && (p = (char_u *)path_tail_with_sep((char *)fname)) != fname) {
+ if (!dir_of_file_exists((char_u *)fname)
+ && (p = (char_u *)path_tail_with_sep(fname)) != (char_u *)fname) {
int c = *p;
// The directory doesn't exist. Try creating it and opening
// the file again.
*p = NUL;
- os_mkdir((char *)fname, 0755);
+ os_mkdir(fname, 0755);
*p = (char_u)c;
- fd = os_fopen((char *)fname, "a");
+ fd = os_fopen(fname, "a");
}
}
@@ -5655,7 +5655,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
}
fclose(fd);
- home_replace(NULL, (char *)fname, (char *)NameBuff, MAXPATHL, true);
+ home_replace(NULL, fname, (char *)NameBuff, MAXPATHL, true);
smsg(_("Word '%.*s' added to %s"), len, word, NameBuff);
}
}
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index 5c2721536d..867fa73419 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -501,7 +501,7 @@ static int sort_compare(const void *s1, const void *s2)
return STRCMP(*(char **)s1, *(char **)s2);
}
-void sort_strings(char_u **files, int count)
+void sort_strings(char **files, int count)
{
qsort((void *)files, (size_t)count, sizeof(char_u *), sort_compare);
}
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index ec68e215c5..3c37dbe450 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -227,12 +227,10 @@ static int current_sub_char = 0;
#define MAX_SYN_INC_TAG 999 // maximum before the above overflow
#define MAX_CLUSTER_ID (32767 - SYNID_CLUSTER)
-/*
- * Annoying Hack(TM): ":syn include" needs this pointer to pass to
- * expand_filename(). Most of the other syntax commands don't need it, so
- * instead of passing it to them, we stow it here.
- */
-static char_u **syn_cmdlinep;
+// Annoying Hack(TM): ":syn include" needs this pointer to pass to
+// expand_filename(). Most of the other syntax commands don't need it, so
+// instead of passing it to them, we stow it here.
+static char **syn_cmdlinep;
/*
* Another Annoying Hack(TM): To prevent rules from other ":syn include"'d
@@ -5602,7 +5600,7 @@ void ex_syntax(exarg_T *eap)
char_u *arg = (char_u *)eap->arg;
char_u *subcmd_end;
- syn_cmdlinep = (char_u **)eap->cmdlinep;
+ syn_cmdlinep = eap->cmdlinep;
// isolate subcommand name
for (subcmd_end = arg; ASCII_ISALPHA(*subcmd_end); subcmd_end++) {}
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index de6635514c..5b799be381 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -165,7 +165,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
fmark_T saved_fmark;
bool jumped_to_tag = false;
int new_num_matches;
- char_u **new_matches;
+ char **new_matches;
int use_tagstack;
int skip_msg = false;
char_u *buf_ffname = (char_u *)curbuf->b_ffname; // name for priority computation
@@ -174,7 +174,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
// remember the matches for the last used tag
static int num_matches = 0;
static int max_num_matches = 0; // limit used for match search
- static char_u **matches = NULL;
+ static char **matches = NULL;
static int flags;
if (tfu_in_use) {
@@ -498,15 +498,15 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
// Find the position of each old match in the new list. Need
// to use parse_match() to find the tag line.
for (j = 0; j < num_matches; j++) {
- parse_match(matches[j], &tagp);
- for (i = idx; i < new_num_matches; ++i) {
- parse_match(new_matches[i], &tagp2);
+ parse_match((char_u *)matches[j], &tagp);
+ for (i = idx; i < new_num_matches; i++) {
+ parse_match((char_u *)new_matches[i], &tagp2);
if (STRCMP(tagp.tagname, tagp2.tagname) == 0) {
- char_u *p = new_matches[i];
+ char_u *p = (char_u *)new_matches[i];
for (k = i; k > idx; k--) {
new_matches[k] = new_matches[k - 1];
}
- new_matches[idx++] = p;
+ new_matches[idx++] = (char *)p;
break;
}
}
@@ -581,7 +581,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
tagstack[tagstackidx].cur_fnum = cur_fnum;
// store user-provided data originating from tagfunc
- if (use_tfu && parse_match(matches[cur_match], &tagp2) == OK
+ if (use_tfu && parse_match((char_u *)matches[cur_match], &tagp2) == OK
&& tagp2.user_data) {
XFREE_CLEAR(tagstack[tagstackidx].user_data);
tagstack[tagstackidx].user_data = vim_strnsave(tagp2.user_data,
@@ -640,7 +640,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
/*
* Jump to the desired match.
*/
- i = jumpto_tag(matches[cur_match], forceit, type != DT_CSCOPE);
+ i = jumpto_tag((char_u *)matches[cur_match], forceit, type != DT_CSCOPE);
set_vim_var_string(VV_SWAPCOMMAND, NULL, -1);
@@ -687,10 +687,8 @@ end_do_tag:
return jumped_to_tag;
}
-//
// List all the matching tags.
-//
-static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char_u **matches)
+static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char **matches)
{
taggy_T *tagstack = curwin->w_tagstack;
int tagstackidx = curwin->w_tagstackidx;
@@ -703,7 +701,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char_
// Assume that the first match indicates how long the tags can
// be, and align the file names to that.
- parse_match(matches[0], &tagp);
+ parse_match((char_u *)matches[0], &tagp);
taglen = (int)(tagp.tagname_end - tagp.tagname + 2);
if (taglen < 18) {
taglen = 18;
@@ -721,7 +719,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char_
msg_puts_attr(_("file\n"), HL_ATTR(HLF_T));
for (i = 0; i < num_matches && !got_int; i++) {
- parse_match(matches[i], &tagp);
+ parse_match((char_u *)matches[i], &tagp);
if (!new_tag && (
(g_do_tagpreview != 0
&& i == ptag_entry.cur_match)
@@ -874,11 +872,9 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char_
}
}
-//
-// Add the matching tags to the location list for the current
-// window.
-//
-static int add_llist_tags(char_u *tag, int num_matches, char_u **matches)
+/// Add the matching tags to the location list for the current
+/// window.
+static int add_llist_tags(char_u *tag, int num_matches, char **matches)
{
list_T *list;
char_u tag_name[128 + 1];
@@ -897,7 +893,7 @@ static int add_llist_tags(char_u *tag, int num_matches, char_u **matches)
long lnum;
dict_T *dict;
- parse_match(matches[i], &tagp);
+ parse_match((char_u *)matches[i], &tagp);
// Save the tag name
len = (int)(tagp.tagname_end - tagp.tagname);
@@ -1366,7 +1362,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
/// @param matchesp return: array of matches found
/// @param mincount MAXCOL: find all matches other: minimal number of matches */
/// @param buf_ffname name of buffer for priority
-int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int mincount,
+int find_tags(char_u *pat, int *num_matches, char ***matchesp, int flags, int mincount,
char_u *buf_ffname)
{
FILE *fp;
@@ -1420,7 +1416,7 @@ int find_tags(char_u *pat, int *num_matches, char_u ***matchesp, int flags, int
hashtab_T ht_match[MT_COUNT]; // stores matches by key
hash_T hash = 0;
int match_count = 0; // number of matches found
- char_u **matches;
+ char **matches;
int mtt;
int help_save;
int help_pri = 0;
@@ -2284,7 +2280,7 @@ findtag_end:
}
}
}
- matches[match_count++] = mfp;
+ matches[match_count++] = (char *)mfp;
}
}
@@ -3094,7 +3090,7 @@ static void tagstack_clear_entry(taggy_T *item)
}
/// @param tagnames expand tag names
-int expand_tags(int tagnames, char_u *pat, int *num_file, char_u ***file)
+int expand_tags(int tagnames, char_u *pat, int *num_file, char ***file)
{
int i;
int extra_flag;
@@ -3125,7 +3121,7 @@ int expand_tags(int tagnames, char_u *pat, int *num_file, char_u ***file)
for (i = 0; i < *num_file; i++) {
size_t len;
- parse_match((*file)[i], &t_p);
+ parse_match((char_u *)(*file)[i], &t_p);
len = (size_t)(t_p.tagname_end - t_p.tagname);
if (len > name_buf_size - 3) {
char_u *buf;
@@ -3196,7 +3192,7 @@ static int add_tag_field(dict_T *dict, const char *field_name, const char_u *sta
int get_tags(list_T *list, char_u *pat, char_u *buf_fname)
{
int num_matches, i, ret;
- char_u **matches;
+ char **matches;
char_u *full_fname;
dict_T *dict;
tagptrs_T tp;
@@ -3205,8 +3201,8 @@ int get_tags(list_T *list, char_u *pat, char_u *buf_fname)
ret = find_tags(pat, &num_matches, &matches,
TAG_REGEXP | TAG_NOIC, MAXCOL, buf_fname);
if (ret == OK && num_matches > 0) {
- for (i = 0; i < num_matches; ++i) {
- int parse_result = parse_match(matches[i], &tp);
+ for (i = 0; i < num_matches; i++) {
+ int parse_result = parse_match((char_u *)matches[i], &tp);
// Avoid an unused variable warning in release builds.
(void)parse_result;
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 8324db37c6..45c083b034 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -2765,7 +2765,7 @@ void ex_undolist(exarg_T *eap)
if (GA_EMPTY(&ga)) {
msg(_("Nothing to undo"));
} else {
- sort_strings((char_u **)ga.ga_data, ga.ga_len);
+ sort_strings(ga.ga_data, ga.ga_len);
msg_start();
msg_puts_attr(_("number changes when saved"),
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 7e47a4f820..ff147e22df 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -6474,7 +6474,7 @@ char_u *grab_file_name(long count, linenr_T *file_lnum)
}
// Only recognize ":123" here
if (file_lnum != NULL && ptr[len] == ':' && isdigit(ptr[len + 1])) {
- char_u *p = ptr + len + 1;
+ char *p = (char *)ptr + len + 1;
*file_lnum = (linenr_T)getdigits_long(&p, false, 0);
}
@@ -6600,7 +6600,7 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
}
p = skipwhite(p);
if (isdigit(*p)) {
- *file_lnum = (linenr_T)getdigits_long((char_u **)&p, false, 0);
+ *file_lnum = (linenr_T)getdigits_long(&p, false, 0);
}
}
}