aboutsummaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c382
1 files changed, 191 insertions, 191 deletions
diff --git a/src/eval.c b/src/eval.c
index 93d33a2c96..c237a90b74 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1051,9 +1051,9 @@ var_redir_start (
redir_endp = get_lval(redir_varname, NULL, redir_lval, FALSE, FALSE, 0,
FNE_CHECK_START);
if (redir_endp == NULL || redir_lval->ll_name == NULL || *redir_endp !=
- NUL) {
+ '\0') {
clear_lval(redir_lval);
- if (redir_endp != NULL && *redir_endp != NUL)
+ if (redir_endp != NULL && *redir_endp != '\0')
/* Trailing characters are present after the variable name */
EMSG(_(e_trailing));
else
@@ -1122,7 +1122,7 @@ void var_redir_stop(void)
if (redir_lval != NULL) {
/* If there was no error: assign the text to the variable. */
if (redir_endp != NULL) {
- ga_append(&redir_ga, NUL); /* Append the trailing NUL. */
+ ga_append(&redir_ga, '\0'); /* Append the trailing NUL. */
tv.v_type = VAR_STRING;
tv.vval.v_string = redir_ga.ga_data;
/* Call get_lval() again, if it's inside a Dict or List it may
@@ -1306,7 +1306,7 @@ char_u *eval_to_string(char_u *arg, char_u **nextcmd, int convert)
if (tv.vval.v_list->lv_len > 0)
ga_append(&ga, NL);
}
- ga_append(&ga, NUL);
+ ga_append(&ga, '\0');
retval = (char_u *)ga.ga_data;
} else if (convert && tv.v_type == VAR_FLOAT) {
vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv.vval.v_float);
@@ -1498,7 +1498,7 @@ call_vim_function (
for (i = 0; i < argc; i++) {
/* Pass a NULL or empty argument as an empty string */
- if (argv[i] == NULL || *argv[i] == NUL) {
+ if (argv[i] == NULL || *argv[i] == '\0') {
argvars[i].v_type = VAR_STRING;
argvars[i].vval.v_string = (char_u *)"";
continue;
@@ -1689,7 +1689,7 @@ int eval_foldexpr(char_u *arg, int *cp)
if (use_sandbox)
++sandbox;
++textlock;
- *cp = NUL;
+ *cp = '\0';
if (eval0(arg, &tv, NULL, TRUE) == FAIL)
retval = 0;
else {
@@ -1764,7 +1764,7 @@ void ex_let(exarg_T *eap)
eap->nextcmd = check_nextcmd(arg);
} else {
op[0] = '=';
- op[1] = NUL;
+ op[1] = '\0';
if (*expr != '=') {
if (vim_strchr((char_u *)"+-.", *expr) != NULL) {
op[0] = *expr; // +=, -=, .=
@@ -1928,7 +1928,7 @@ static char_u *skip_var_list(char_u *arg, int *var_count, int *semicolon)
*/
static char_u *skip_var_one(char_u *arg)
{
- if (*arg == '@' && arg[1] != NUL)
+ if (*arg == '@' && arg[1] != '\0')
return arg + 2;
return find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
@@ -2090,7 +2090,7 @@ static char_u *list_arg_vars(exarg_T *eap, char_u *arg, int *first)
s = echo_string(&tv, &tf, numbuf, 0);
c = *arg;
- *arg = NUL;
+ *arg = '\0';
list_one_var_a((char_u *)"",
arg == arg_subsc ? name : name_start,
tv.v_type,
@@ -2153,7 +2153,7 @@ ex_let_one (
EMSG(_(e_letunexp));
else if (!check_secure()) {
c1 = name[len];
- name[len] = NUL;
+ name[len] = '\0';
p = get_tv_string_chk(tv);
if (p != NULL && op != NULL && *op == '.') {
int mustfree = FALSE;
@@ -2200,7 +2200,7 @@ ex_let_one (
char_u *s;
c1 = *p;
- *p = NUL;
+ *p = '\0';
n = get_tv_number(tv);
s = get_tv_string_chk(tv); /* != NULL if number or string */
@@ -2376,7 +2376,7 @@ get_lval (
return p;
cc = *p;
- *p = NUL;
+ *p = '\0';
v = find_var(lp->ll_name, &ht, flags & GLV_NO_AUTOLOAD);
if (v == NULL && !quiet)
EMSG2(_(e_undefvar), lp->ll_name);
@@ -2486,7 +2486,7 @@ get_lval (
if (len == -1) {
/* "[key]": get key from "var1" */
key = get_tv_string(&var1); /* is number or string */
- if (*key == NUL) {
+ if (*key == '\0') {
if (!quiet)
EMSG(_(e_emptykey));
clear_tv(&var1);
@@ -2506,7 +2506,7 @@ get_lval (
if (len != -1) {
prevval = key[len];
- key[len] = NUL;
+ key[len] = '\0';
} else
prevval = 0; /* avoid compiler warning */
wrong = (lp->ll_dict->dv_scope == VAR_DEF_SCOPE
@@ -2637,7 +2637,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, ch
if (lp->ll_tv == NULL) {
if (!check_changedtick(lp->ll_name)) {
cc = *endp;
- *endp = NUL;
+ *endp = '\0';
if (op != NULL && *op != '=') {
typval_T tv;
@@ -2986,13 +2986,13 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
break;
} else if (cmdidx != CMD_let || got_eq) {
if (c == '"') { /* string */
- while ((c = *++xp->xp_pattern) != NUL && c != '"')
- if (c == '\\' && xp->xp_pattern[1] != NUL)
+ while ((c = *++xp->xp_pattern) != '\0' && c != '"')
+ if (c == '\\' && xp->xp_pattern[1] != '\0')
++xp->xp_pattern;
xp->xp_context = EXPAND_NOTHING;
} else if (c == '\'') { /* literal string */
/* Trick: '' is like stopping and starting a literal string. */
- while ((c = *++xp->xp_pattern) != NUL && c != '\'')
+ while ((c = *++xp->xp_pattern) != '\0' && c != '\'')
/* skip */;
xp->xp_context = EXPAND_NOTHING;
} else if (c == '|') {
@@ -3008,8 +3008,8 @@ void set_context_for_expression(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
* anyway. */
xp->xp_context = EXPAND_EXPRESSION;
arg = xp->xp_pattern;
- if (*arg != NUL)
- while ((c = *++arg) != NUL && (c == ' ' || c == '\t'))
+ if (*arg != '\0')
+ while ((c = *++arg) != '\0' && (c == ' ' || c == '\t'))
/* skip */;
}
xp->xp_pattern = arg;
@@ -3210,7 +3210,7 @@ static int do_unlet_var(lval_T *lp, char_u *name_end, int forceit)
if (lp->ll_tv == NULL) {
cc = *name_end;
- *name_end = NUL;
+ *name_end = '\0';
/* Normal name or expanded name. */
if (check_changedtick(lp->ll_name))
@@ -3254,7 +3254,7 @@ int do_unlet(char_u *name, int forceit)
dictitem_T *di;
ht = find_var_ht(name, &varname);
- if (ht != NULL && *varname != NUL) {
+ if (ht != NULL && *varname != '\0') {
hi = hash_find(ht, varname);
if (!HASHITEM_EMPTY(hi)) {
di = HI2DI(hi);
@@ -3287,7 +3287,7 @@ static int do_lock_var(lval_T *lp, char_u *name_end, int deep, int lock)
if (lp->ll_tv == NULL) {
cc = *name_end;
- *name_end = NUL;
+ *name_end = '\0';
/* Normal name or expanded name. */
if (check_changedtick(lp->ll_name))
@@ -4471,7 +4471,7 @@ eval7 (
rettv->v_type = VAR_STRING;
rettv->vval.v_string = get_reg_contents(**arg, TRUE, TRUE);
}
- if (**arg != NUL)
+ if (**arg != '\0')
++*arg;
break;
@@ -4788,7 +4788,7 @@ eval_index (
if (len == -1) {
key = get_tv_string(&var1);
- if (*key == NUL) {
+ if (*key == '\0') {
if (verbose)
EMSG(_(e_emptykey));
clear_tv(&var1);
@@ -4854,7 +4854,7 @@ get_option_tv (
}
c = *option_end;
- *option_end = NUL;
+ *option_end = '\0';
opt_type = get_option_value(*arg, &numval,
rettv == NULL ? NULL : &stringval, opt_flags);
@@ -4898,8 +4898,8 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
/*
* Find the end of the string, skipping backslashed characters.
*/
- for (p = *arg + 1; *p != NUL && *p != '"'; mb_ptr_adv(p)) {
- if (*p == '\\' && p[1] != NUL) {
+ for (p = *arg + 1; *p != '\0' && *p != '"'; mb_ptr_adv(p)) {
+ if (*p == '\\' && p[1] != '\0') {
++p;
/* A "\<x>" form occupies at least 4 characters, and produces up
* to 6 characters: reserve space for 2 extra */
@@ -4929,7 +4929,7 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = name;
- for (p = *arg + 1; *p != NUL && *p != '"'; ) {
+ for (p = *arg + 1; *p != '\0' && *p != '"'; ) {
if (*p == '\\') {
switch (*++p) {
case 'b': *name++ = BS; ++p; break;
@@ -4998,7 +4998,7 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
MB_COPY_CHAR(p, name);
}
- *name = NUL;
+ *name = '\0';
*arg = p + 1;
return OK;
@@ -5017,7 +5017,7 @@ static int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate)
/*
* Find the end of the string, skipping ''.
*/
- for (p = *arg + 1; *p != NUL; mb_ptr_adv(p)) {
+ for (p = *arg + 1; *p != '\0'; mb_ptr_adv(p)) {
if (*p == '\'') {
if (p[1] != '\'')
break;
@@ -5046,7 +5046,7 @@ static int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = str;
- for (p = *arg + 1; *p != NUL; ) {
+ for (p = *arg + 1; *p != '\0'; ) {
if (*p == '\'') {
if (p[1] != '\'')
break;
@@ -5054,7 +5054,7 @@ static int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate)
}
MB_COPY_CHAR(p, str);
}
- *str = NUL;
+ *str = '\0';
*arg = p + 1;
return OK;
@@ -5077,7 +5077,7 @@ static int get_list_tv(char_u **arg, typval_T *rettv, int evaluate)
}
*arg = skipwhite(*arg + 1);
- while (**arg != ']' && **arg != NUL) {
+ while (**arg != ']' && **arg != '\0') {
if (eval1(arg, &tv, evaluate) == FAIL) /* recursive! */
goto failret;
if (evaluate) {
@@ -5730,7 +5730,7 @@ static char_u *list2string(typval_T *tv, int copyID)
return NULL;
}
ga_append(&ga, ']');
- ga_append(&ga, NUL);
+ ga_append(&ga, '\0');
return (char_u *)ga.ga_data;
}
@@ -6444,7 +6444,7 @@ static char_u *dict2string(typval_T *tv, int copyID)
}
ga_append(&ga, '}');
- ga_append(&ga, NUL);
+ ga_append(&ga, '\0');
return (char_u *)ga.ga_data;
}
@@ -6485,7 +6485,7 @@ static int get_dict_tv(char_u **arg, typval_T *rettv, int evaluate)
tv.v_type = VAR_UNKNOWN;
*arg = skipwhite(*arg + 1);
- while (**arg != '}' && **arg != NUL) {
+ while (**arg != '}' && **arg != '\0') {
if (eval1(arg, &tvkey, evaluate) == FAIL) /* recursive! */
goto failret;
if (**arg != ':') {
@@ -6495,7 +6495,7 @@ static int get_dict_tv(char_u **arg, typval_T *rettv, int evaluate)
}
if (evaluate) {
key = get_tv_string_buf_chk(&tvkey, buf);
- if (key == NULL || *key == NUL) {
+ if (key == NULL || *key == '\0') {
/* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */
if (key != NULL)
EMSG(_(e_emptykey));
@@ -6673,7 +6673,7 @@ static char_u *string_quote(char_u *str, int function)
len = (function ? 13 : 3);
if (str != NULL) {
len += (unsigned)STRLEN(str);
- for (p = str; *p != NUL; mb_ptr_adv(p))
+ for (p = str; *p != '\0'; mb_ptr_adv(p))
if (*p == '\'')
++len;
}
@@ -6685,7 +6685,7 @@ static char_u *string_quote(char_u *str, int function)
} else
*r++ = '\'';
if (str != NULL)
- for (p = str; *p != NUL; ) {
+ for (p = str; *p != '\0'; ) {
if (*p == '\'')
*r++ = '\'';
MB_COPY_CHAR(p, r);
@@ -6693,7 +6693,7 @@ static char_u *string_quote(char_u *str, int function)
*r++ = '\'';
if (function)
*r++ = ')';
- *r++ = NUL;
+ *r++ = '\0';
}
return s;
}
@@ -6738,10 +6738,10 @@ static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate)
if (evaluate) {
if (len != 0) {
cc = name[len];
- name[len] = NUL;
+ name[len] = '\0';
/* first try vim_getenv(), fast for normal environment vars */
string = vim_getenv(name, &mustfree);
- if (string != NULL && *string != NUL) {
+ if (string != NULL && *string != '\0') {
if (!mustfree)
string = vim_strsave(string);
} else {
@@ -7136,7 +7136,7 @@ static char_u *deref_func_name(char_u *name, int *lenp, int no_autoload)
int cc;
cc = name[*lenp];
- name[*lenp] = NUL;
+ name[*lenp] = '\0';
v = find_var(name, NULL, no_autoload);
name[*lenp] = cc;
if (v != NULL && v->di_tv.v_type == VAR_FUNC) {
@@ -7179,7 +7179,7 @@ get_func_tv (
argp = *arg;
while (argcount < MAX_FUNC_ARGS) {
argp = skipwhite(argp + 1); /* skip the '(' or ',' */
- if (*argp == ')' || *argp == ',' || *argp == NUL)
+ if (*argp == ')' || *argp == ',' || *argp == '\0')
break;
if (eval1(&argp, &argvars[argcount], evaluate) == FAIL) {
ret = FAIL;
@@ -7447,7 +7447,7 @@ static int non_zero_arg(typval_T *argvars)
&& argvars[0].vval.v_number != 0)
|| (argvars[0].v_type == VAR_STRING
&& argvars[0].vval.v_string != NULL
- && *argvars[0].vval.v_string != NUL);
+ && *argvars[0].vval.v_string != '\0');
}
/*********************************************
@@ -7765,9 +7765,9 @@ static buf_T *get_buf_tv(typval_T *tv, int curtab_only)
return buflist_findnr((int)tv->vval.v_number);
if (tv->v_type != VAR_STRING)
return NULL;
- if (name == NULL || *name == NUL)
+ if (name == NULL || *name == '\0')
return curbuf;
- if (name[0] == '$' && name[1] == NUL)
+ if (name[0] == '$' && name[1] == '\0')
return lastbuf;
/* Ignore 'magic' and 'cpoptions' here to make scripts portable */
@@ -7887,7 +7887,7 @@ static void byteidx(typval_T *argvars, typval_T *rettv, int comp)
t = str;
for (; idx > 0; idx--) {
- if (*t == NUL) /* EOL reached */
+ if (*t == '\0') /* EOL reached */
return;
if (enc_utf8 && comp)
t += utf_ptr2len(t);
@@ -7964,7 +7964,7 @@ static void f_call(typval_T *argvars, typval_T *rettv)
func = argvars[0].vval.v_string;
else
func = get_tv_string(&argvars[0]);
- if (*func == NUL)
+ if (*func == '\0')
return; /* type error or empty name */
if (argvars[2].v_type != VAR_UNKNOWN) {
@@ -8073,7 +8073,7 @@ static void f_col(typval_T *argvars, typval_T *rettv)
curwin->w_virtcol - curwin->w_cursor.coladd)) {
int l;
- if (*p != NUL && p[(l = (*mb_ptr2len)(p))] == NUL)
+ if (*p != '\0' && p[(l = (*mb_ptr2len)(p))] == '\0')
col += l;
}
}
@@ -8172,7 +8172,7 @@ static void f_confirm(typval_T *argvars, typval_T *rettv)
}
}
- if (buttons == NULL || *buttons == NUL)
+ if (buttons == NULL || *buttons == '\0')
buttons = (char_u *)_("&Ok");
if (!error)
@@ -8452,7 +8452,7 @@ static void f_empty(typval_T *argvars, typval_T *rettv)
case VAR_STRING:
case VAR_FUNC:
n = argvars[0].vval.v_string == NULL
- || *argvars[0].vval.v_string == NUL;
+ || *argvars[0].vval.v_string == '\0';
break;
case VAR_NUMBER:
n = argvars[0].vval.v_number == 0;
@@ -8502,7 +8502,7 @@ static void f_eval(typval_T *argvars, typval_T *rettv)
if (s == NULL || eval1(&s, rettv, TRUE) == FAIL) {
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
- } else if (*s != NUL)
+ } else if (*s != '\0')
EMSG(_(e_trailing));
}
@@ -8546,7 +8546,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv)
}
} else if (*p == '&' || *p == '+') { /* option */
n = (get_option_tv(&p, NULL, TRUE) == OK);
- if (*skipwhite(p) != NUL)
+ if (*skipwhite(p) != '\0')
n = FALSE; /* trailing garbage */
} else if (*p == '*') { /* internal or user defined function */
n = function_exists(p + 1);
@@ -8575,7 +8575,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv)
clear_tv(&tv);
}
}
- if (*p != NUL)
+ if (*p != '\0')
n = FALSE;
vim_free(tofree);
@@ -8794,10 +8794,10 @@ static void f_feedkeys(typval_T *argvars, typval_T *rettv)
return;
keys = get_tv_string(&argvars[0]);
- if (*keys != NUL) {
+ if (*keys != '\0') {
if (argvars[1].v_type != VAR_UNKNOWN) {
flags = get_tv_string_buf(&argvars[1], nbuf);
- for (; *flags != NUL; ++flags) {
+ for (; *flags != '\0'; ++flags) {
switch (*flags) {
case 'n': remap = FALSE; break;
case 'm': remap = TRUE; break;
@@ -8859,7 +8859,7 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
{
char_u *fname;
char_u *fresult = NULL;
- char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path;
+ char_u *path = *curbuf->b_p_path == '\0' ? p_path : curbuf->b_p_path;
char_u *p;
char_u pathbuf[NUMBUFLEN];
int count = 1;
@@ -8876,7 +8876,7 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
if (p == NULL)
error = TRUE;
else {
- if (*p != NUL)
+ if (*p != '\0')
path = p;
if (argvars[2].v_type != VAR_UNKNOWN)
@@ -8888,7 +8888,7 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
rettv_list_alloc(rettv);
}
- if (*fname != NUL && !error) {
+ if (*fname != '\0' && !error) {
do {
if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST)
vim_free(fresult);
@@ -9023,7 +9023,7 @@ static int filter_map_one(typval_T *tv, char_u *expr, int map, int *remp)
s = expr;
if (eval1(&s, &rettv, TRUE) == FAIL)
goto theend;
- if (*s != NUL) { /* check for trailing chars after expr */
+ if (*s != '\0') { /* check for trailing chars after expr */
EMSG2(_(e_invexpr2), s);
goto theend;
}
@@ -9239,7 +9239,7 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv)
/* skip C comment-start */
if (s[0] == '/' && (s[1] == '*' || s[1] == '/')) {
s = skipwhite(s + 2);
- if (*skipwhite(s) == NUL
+ if (*skipwhite(s) == '\0'
&& lnum + 1 < (linenr_T)vimvars[VV_FOLDEND].vv_nr) {
s = skipwhite(ml_get(lnum + 1));
if (*s == '*')
@@ -9306,7 +9306,7 @@ static void f_function(typval_T *argvars, typval_T *rettv)
char_u *s;
s = get_tv_string(&argvars[0]);
- if (s == NULL || *s == NUL || VIM_ISDIGIT(*s))
+ if (s == NULL || *s == '\0' || VIM_ISDIGIT(*s))
EMSG2(_(e_invarg2), s);
/* Don't check an autoload name for existence here. */
else if (vim_strchr(s, AUTOLOAD_CHAR) == NULL && !function_exists(s))
@@ -9521,7 +9521,7 @@ static void f_getchar(typval_T *argvars, typval_T *rettv)
else if (get_tv_number_chk(&argvars[0], &error) == 1)
/* getchar(1): only check if char avail */
n = vpeekc();
- else if (error || vpeekc() == NUL)
+ else if (error || vpeekc() == '\0')
/* illegal argument or getchar(0) and no char avail: return zero */
n = 0;
else
@@ -9557,7 +9557,7 @@ static void f_getchar(typval_T *argvars, typval_T *rettv)
i += (*mb_char2bytes)(n, temp + i);
else
temp[i++] = n;
- temp[i++] = NUL;
+ temp[i++] = '\0';
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave(temp);
@@ -9618,7 +9618,7 @@ static void f_getcmdtype(typval_T *argvars, typval_T *rettv)
rettv->vval.v_string = alloc(2);
if (rettv->vval.v_string != NULL) {
rettv->vval.v_string[0] = get_cmdline_type();
- rettv->vval.v_string[1] = NUL;
+ rettv->vval.v_string[1] = '\0';
}
}
@@ -9933,8 +9933,8 @@ static void f_getregtype(typval_T *argvars, typval_T *rettv)
if (regname == 0)
regname = '"';
- buf[0] = NUL;
- buf[1] = NUL;
+ buf[0] = '\0';
+ buf[1] = '\0';
switch (get_reg_type(regname, &reglen)) {
case MLINE: buf[0] = 'V'; break;
case MCHAR: buf[0] = 'v'; break;
@@ -10408,9 +10408,9 @@ static void f_histadd(typval_T *argvars, typval_T *rettv)
histype = str != NULL ? get_histtype(str) : -1;
if (histype >= 0) {
str = get_tv_string_buf(&argvars[1], buf);
- if (*str != NUL) {
+ if (*str != '\0') {
init_history();
- add_to_history(histype, str, FALSE, NUL);
+ add_to_history(histype, str, FALSE, '\0');
rettv->vval.v_number = TRUE;
return;
}
@@ -10636,7 +10636,7 @@ static void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog)
else {
++p;
c = *p;
- *p = NUL;
+ *p = '\0';
msg_start();
msg_clr_eos();
msg_puts_attr(prompt, echo_attr);
@@ -10675,7 +10675,7 @@ static void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog)
int save_ex_normal_busy = ex_normal_busy;
ex_normal_busy = 0;
rettv->vval.v_string =
- getcmdline_prompt(inputsecret_flag ? NUL : '@', p, echo_attr,
+ getcmdline_prompt(inputsecret_flag ? '\0' : '@', p, echo_attr,
xp_type, xp_arg);
ex_normal_busy = save_ex_normal_busy;
}
@@ -10856,7 +10856,7 @@ static void f_islocked(typval_T *argvars, typval_T *rettv)
end = get_lval(get_tv_string(&argvars[0]), NULL, &lv, FALSE, FALSE,
GLV_NO_AUTOLOAD, FNE_CHECK_START);
if (end != NULL && lv.ll_name != NULL) {
- if (*end != NUL)
+ if (*end != '\0')
EMSG(_(e_trailing));
else {
if (lv.ll_tv == NULL) {
@@ -11127,7 +11127,7 @@ static void f_join(typval_T *argvars, typval_T *rettv)
if (sep != NULL) {
ga_init(&ga, (int)sizeof(char), 80);
list_join(&ga, argvars[0].vval.v_list, sep, TRUE, 0);
- ga_append(&ga, NUL);
+ ga_append(&ga, '\0');
rettv->vval.v_string = (char_u *)ga.ga_data;
} else
rettv->vval.v_string = NULL;
@@ -11311,7 +11311,7 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
rettv->vval.v_string = NULL;
keys = get_tv_string(&argvars[0]);
- if (*keys == NUL)
+ if (*keys == '\0')
return;
if (argvars[1].v_type != VAR_UNKNOWN) {
@@ -11776,12 +11776,12 @@ static void f_mkdir(typval_T *argvars, typval_T *rettv)
return;
dir = get_tv_string_buf(&argvars[0], buf);
- if (*dir == NUL)
+ if (*dir == '\0')
rettv->vval.v_number = FAIL;
else {
- if (*path_tail(dir) == NUL)
+ if (*path_tail(dir) == '\0')
/* remove trailing slashes */
- *path_tail_with_sep(dir) = NUL;
+ *path_tail_with_sep(dir) = '\0';
if (argvars[1].v_type != VAR_UNKNOWN) {
if (argvars[2].v_type != VAR_UNKNOWN)
@@ -11800,8 +11800,8 @@ static void f_mode(typval_T *argvars, typval_T *rettv)
{
char_u buf[3];
- buf[1] = NUL;
- buf[2] = NUL;
+ buf[1] = '\0';
+ buf[2] = '\0';
if (VIsual_active) {
if (VIsual_select)
@@ -11841,7 +11841,7 @@ static void f_mode(typval_T *argvars, typval_T *rettv)
/* Clear out the minor mode when the argument is not a non-zero number or
* non-empty string. */
if (!non_zero_arg(&argvars[0]))
- buf[1] = NUL;
+ buf[1] = '\0';
rettv->vval.v_string = vim_strsave(buf);
rettv->v_type = VAR_STRING;
@@ -11860,7 +11860,7 @@ static void f_nextnonblank(typval_T *argvars, typval_T *rettv)
lnum = 0;
break;
}
- if (*skipwhite(ml_get(lnum)) != NUL)
+ if (*skipwhite(ml_get(lnum)) != '\0')
break;
}
rettv->vval.v_number = lnum;
@@ -11879,12 +11879,12 @@ static void f_nr2char(typval_T *argvars, typval_T *rettv)
if (argvars[1].v_type != VAR_UNKNOWN)
utf8 = get_tv_number_chk(&argvars[1], NULL);
if (utf8)
- buf[(*utf_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL;
+ buf[(*utf_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = '\0';
else
- buf[(*mb_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL;
+ buf[(*mb_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = '\0';
} else {
buf[0] = (char_u)get_tv_number(&argvars[0]);
- buf[1] = NUL;
+ buf[1] = '\0';
}
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave(buf);
@@ -11944,7 +11944,7 @@ static void f_prevnonblank(typval_T *argvars, typval_T *rettv)
if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count)
lnum = 0;
else
- while (lnum >= 1 && *skipwhite(ml_get(lnum)) == NUL)
+ while (lnum >= 1 && *skipwhite(ml_get(lnum)) == '\0')
--lnum;
rettv->vval.v_number = lnum;
}
@@ -12062,8 +12062,8 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
/* Always open the file in binary mode, library functions have a mind of
* their own about CR-LF conversion. */
fname = get_tv_string(&argvars[0]);
- if (*fname == NUL || (fd = mch_fopen((char *)fname, READBIN)) == NULL) {
- EMSG2(_(e_notopen), *fname == NUL ? (char_u *)_("<empty>") : fname);
+ if (*fname == '\0' || (fd = mch_fopen((char *)fname, READBIN)) == NULL) {
+ EMSG2(_(e_notopen), *fname == '\0' ? (char_u *)_("<empty>") : fname);
return;
}
@@ -12100,7 +12100,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
* allocated only once. */
if ((s = xrealloc(prev, prevlen + len + 1)) != NULL) {
memmove(s + prevlen, start, len);
- s[prevlen + len] = NUL;
+ s[prevlen + len] = '\0';
prev = NULL; /* the list will own the string */
prevlen = prevsize = 0;
}
@@ -12124,7 +12124,7 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
start = p + 1; /* step over newline */
if ((++cnt >= maxline && maxline >= 0) || readlen <= 0)
break;
- } else if (*p == NUL)
+ } else if (*p == '\0')
*p = '\n';
/* Check for utf8 "bom"; U+FEFF is encoded as EF BB BF. Do this
* when finding the BF and check the previous two bytes. */
@@ -12132,10 +12132,10 @@ static void f_readfile(typval_T *argvars, typval_T *rettv)
/* Find the two bytes before the 0xbf. If p is at buf, or buf
* + 1, these may be in the "prev" string. */
char_u back1 = p >= buf + 1 ? p[-1]
- : prevlen >= 1 ? prev[prevlen - 1] : NUL;
+ : prevlen >= 1 ? prev[prevlen - 1] : '\0';
char_u back2 = p >= buf + 2 ? p[-2]
: p == buf + 1 && prevlen >= 1 ? prev[prevlen - 1]
- : prevlen >= 2 ? prev[prevlen - 2] : NUL;
+ : prevlen >= 2 ? prev[prevlen - 2] : '\0';
if (back2 == 0xef && back1 == 0xbb) {
char_u *dest = p - 2;
@@ -12456,7 +12456,7 @@ static void f_repeat(typval_T *argvars, typval_T *rettv)
if (r != NULL) {
for (i = 0; i < n; i++)
memmove(r + i * slen, p, (size_t)slen);
- r[len] = NUL;
+ r[len] = '\0';
}
rettv->vval.v_string = r;
@@ -12504,15 +12504,15 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
len = STRLEN(p);
if (len > 0 && after_pathsep(p, p + len)) {
has_trailing_pathsep = TRUE;
- p[len - 1] = NUL; /* the trailing slash breaks readlink() */
+ p[len - 1] = '\0'; /* the trailing slash breaks readlink() */
}
q = path_next_component(p);
- if (*q != NUL) {
+ if (*q != '\0') {
/* Separate the first path component in "p", and keep the
* remainder (beginning with the path separator). */
remain = vim_strsave(q - 1);
- q[-1] = NUL;
+ q[-1] = '\0';
}
buf = alloc(MAXPATHL + 1);
@@ -12524,7 +12524,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
len = readlink((char *)p, (char *)buf, MAXPATHL);
if (len <= 0)
break;
- buf[len] = NUL;
+ buf[len] = '\0';
if (limit-- == 0) {
vim_free(p);
@@ -12542,7 +12542,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
/* Separate the first path component in the link value and
* concatenate the remainders. */
q = path_next_component(vim_ispathsep(*buf) ? buf + 1 : buf);
- if (*q != NUL) {
+ if (*q != '\0') {
if (remain == NULL)
remain = vim_strsave(q - 1);
else {
@@ -12552,13 +12552,13 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
remain = cpy;
}
}
- q[-1] = NUL;
+ q[-1] = '\0';
}
q = path_tail(p);
- if (q > p && *q == NUL) {
+ if (q > p && *q == '\0') {
/* Ignore trailing path separator. */
- q[-1] = NUL;
+ q[-1] = '\0';
q = path_tail(p);
}
if (q > p && !path_is_absolute_path(buf)) {
@@ -12581,7 +12581,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
/* Append the first path component of "remain" to "p". */
q = path_next_component(remain + 1);
- len = q - remain - (*q != NUL);
+ len = q - remain - (*q != '\0');
cpy = vim_strnsave(p, STRLEN(p) + len);
if (cpy != NULL) {
STRNCAT(cpy, remain, len);
@@ -12589,7 +12589,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
p = cpy;
}
/* Shorten "remain". */
- if (*q != NUL)
+ if (*q != '\0')
STRMOVE(remain, q - 1);
else {
vim_free(remain);
@@ -12601,12 +12601,12 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
* the current directory if and only if the argument had this form. */
if (!vim_ispathsep(*p)) {
if (is_relative_to_current
- && *p != NUL
+ && *p != '\0'
&& !(p[0] == '.'
- && (p[1] == NUL
+ && (p[1] == '\0'
|| vim_ispathsep(p[1])
|| (p[1] == '.'
- && (p[2] == NUL
+ && (p[2] == '\0'
|| vim_ispathsep(p[2])))))) {
/* Prepend "./". */
cpy = concat_str((char_u *)"./", p);
@@ -12629,7 +12629,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv)
if (!has_trailing_pathsep) {
q = p + STRLEN(p);
if (after_pathsep(p, q))
- *path_tail_with_sep(p) = NUL;
+ *path_tail_with_sep(p) = '\0';
}
rettv->vval.v_string = p;
@@ -12701,7 +12701,7 @@ static int get_search_arg(typval_T *varp, int *flagsp)
flags = get_tv_string_buf_chk(varp, nbuf);
if (flags == NULL)
return 0; /* type error; errmsg already given */
- while (*flags != NUL) {
+ while (*flags != '\0') {
switch (*flags) {
case 'b': dir = BACKWARD; break;
case 'w': p_ws = TRUE; break;
@@ -13082,7 +13082,7 @@ do_searchpair (
if (pat2 == NULL || pat3 == NULL)
goto theend;
sprintf((char *)pat2, "\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat);
- if (*mpat == NUL)
+ if (*mpat == '\0')
STRCPY(pat3, pat2);
else
sprintf((char *)pat3, "\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)",
@@ -13119,7 +13119,7 @@ do_searchpair (
options &= ~SEARCH_START;
/* If the skip pattern matches, ignore this match. */
- if (*skip != NUL) {
+ if (*skip != '\0') {
save_pos = curwin->w_cursor;
curwin->w_cursor = pos;
r = eval_to_bool(skip, &err, NULL, FALSE);
@@ -13455,7 +13455,7 @@ static void f_setpos(typval_T *argvars, typval_T *rettv)
if (list2fpos(&argvars[1], &pos, &fnum) == OK) {
if (--pos.col < 0)
pos.col = 0;
- if (name[0] == '.' && name[1] == NUL) {
+ if (name[0] == '.' && name[1] == '\0') {
/* set cursor */
if (fnum == curbuf->b_fnum) {
curwin->w_cursor = pos;
@@ -13463,7 +13463,7 @@ static void f_setpos(typval_T *argvars, typval_T *rettv)
rettv->vval.v_number = 0;
} else
EMSG(_(e_invarg));
- } else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) {
+ } else if (name[0] == '\'' && name[1] != '\0' && name[2] == '\0') {
/* set mark */
if (setmark_pos(name[1], &pos, fnum) == OK)
rettv->vval.v_number = 0;
@@ -13513,7 +13513,7 @@ static void f_setreg(typval_T *argvars, typval_T *rettv)
stropt = get_tv_string_chk(&argvars[2]);
if (stropt == NULL)
return; /* type error */
- for (; *stropt != NUL; ++stropt)
+ for (; *stropt != '\0'; ++stropt)
switch (*stropt) {
case 'a': case 'A': /* append */
append = TRUE;
@@ -13959,13 +13959,13 @@ static void f_spellbadword(typval_T *argvars, typval_T *rettv)
len = spell_move_to(curwin, FORWARD, TRUE, TRUE, &attr);
if (len != 0)
word = ml_get_cursor();
- } else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL) {
+ } else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != '\0') {
char_u *str = get_tv_string_chk(&argvars[0]);
int capcol = -1;
if (str != NULL) {
/* Check the argument for spelling. */
- while (*str != NUL) {
+ while (*str != '\0') {
len = spell_check(curwin, str, &attr, &capcol, FALSE);
if (attr != HLF_COUNT) {
word = str;
@@ -14000,7 +14000,7 @@ static void f_spellsuggest(typval_T *argvars, typval_T *rettv)
rettv_list_alloc(rettv);
- if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) {
+ if (curwin->w_p_spell && *curwin->w_s->b_p_spl != '\0') {
str = get_tv_string(&argvars[0]);
if (argvars[1].v_type != VAR_UNKNOWN) {
maxcount = get_tv_number_chk(&argvars[1], &typeerr);
@@ -14058,7 +14058,7 @@ static void f_split(typval_T *argvars, typval_T *rettv)
if (argvars[2].v_type != VAR_UNKNOWN)
keepempty = get_tv_number_chk(&argvars[2], &typeerr);
}
- if (pat == NULL || *pat == NUL)
+ if (pat == NULL || *pat == '\0')
pat = (char_u *)"[\\x01- ]\\+";
rettv_list_alloc(rettv);
@@ -14069,8 +14069,8 @@ static void f_split(typval_T *argvars, typval_T *rettv)
regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING);
if (regmatch.regprog != NULL) {
regmatch.rm_ic = FALSE;
- while (*str != NUL || keepempty) {
- if (*str == NUL)
+ while (*str != '\0' || keepempty) {
+ if (*str == '\0')
match = FALSE; /* empty item at the end */
else
match = vim_regexec_nl(&regmatch, str, col);
@@ -14079,7 +14079,7 @@ static void f_split(typval_T *argvars, typval_T *rettv)
else
end = str + STRLEN(str);
if (keepempty || end > str || (rettv->vval.v_list->lv_len > 0
- && *str != NUL && match && end <
+ && *str != '\0' && match && end <
regmatch.endp[0])) {
list_append_string(rettv->vval.v_list, str, (int)(end - str));
}
@@ -14186,7 +14186,7 @@ static void f_strftime(typval_T *argvars, typval_T *rettv)
(void)strftime((char *)result_buf, sizeof(result_buf),
(char *)p, curtime);
else
- result_buf[0] = NUL;
+ result_buf[0] = '\0';
if (conv.vc_type != CONV_NONE)
vim_free(p);
@@ -14267,7 +14267,7 @@ static void f_strchars(typval_T *argvars, typval_T *rettv)
char_u *s = get_tv_string(&argvars[0]);
varnumber_T len = 0;
- while (*s != NUL) {
+ while (*s != '\0') {
mb_cptr2char_adv(&s);
++len;
}
@@ -14368,7 +14368,7 @@ static void f_strridx(typval_T *argvars, typval_T *rettv)
} else
end_idx = haystack_len;
- if (*needle == NUL) {
+ if (*needle == '\0') {
/* Empty string matches past the end. */
lastmatch = haystack + end_idx;
} else {
@@ -14579,7 +14579,7 @@ static void f_synconcealed(typval_T *argvars, typval_T *rettv)
lnum = get_tv_lnum(argvars); /* -1 on type error */
col = get_tv_number(&argvars[1]) - 1; /* -1 on type error */
- memset(str, NUL, sizeof(str));
+ memset(str, '\0', sizeof(str));
rettv_list_alloc(rettv);
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0
@@ -14590,10 +14590,10 @@ static void f_synconcealed(typval_T *argvars, typval_T *rettv)
// get the conceal character
if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3) {
cchar = syn_get_sub_char();
- if (cchar == NUL && curwin->w_p_cole == 1 && lcs_conceal != NUL) {
+ if (cchar == '\0' && curwin->w_p_cole == 1 && lcs_conceal != '\0') {
cchar = lcs_conceal;
}
- if (cchar != NUL) {
+ if (cchar != '\0') {
if (has_mbyte)
(*mb_char2bytes)(cchar, str);
else
@@ -14707,7 +14707,7 @@ static void f_system(typval_T *argvars, typval_T *rettv)
++s;
*d++ = *s;
}
- *d = NUL;
+ *d = '\0';
}
# endif
#endif
@@ -14859,7 +14859,7 @@ static void f_taglist(typval_T *argvars, typval_T *rettv)
tag_pattern = get_tv_string(&argvars[0]);
rettv->vval.v_number = FALSE;
- if (*tag_pattern == NUL)
+ if (*tag_pattern == '\0')
return;
rettv_list_alloc(rettv);
@@ -14937,7 +14937,7 @@ static void f_tolower(typval_T *argvars, typval_T *rettv)
rettv->vval.v_string = p;
if (p != NULL)
- while (*p != NUL) {
+ while (*p != '\0') {
int l;
if (enc_utf8) {
@@ -15009,16 +15009,16 @@ error:
}
/* fromstr and tostr have to contain the same number of chars */
- while (*in_str != NUL) {
+ while (*in_str != '\0') {
if (has_mbyte) {
inlen = (*mb_ptr2len)(in_str);
cpstr = in_str;
cplen = inlen;
idx = 0;
- for (p = fromstr; *p != NUL; p += fromlen) {
+ for (p = fromstr; *p != '\0'; p += fromlen) {
fromlen = (*mb_ptr2len)(p);
if (fromlen == inlen && STRNCMP(in_str, p, inlen) == 0) {
- for (p = tostr; *p != NUL; p += tolen) {
+ for (p = tostr; *p != '\0'; p += tolen) {
tolen = (*mb_ptr2len)(p);
if (idx-- == 0) {
cplen = tolen;
@@ -15026,7 +15026,7 @@ error:
break;
}
}
- if (*p == NUL) /* tostr is shorter than fromstr */
+ if (*p == '\0') /* tostr is shorter than fromstr */
goto error;
break;
}
@@ -15038,7 +15038,7 @@ error:
* (multi-byte) characters. Done only once when a character
* of in_str doesn't appear in fromstr. */
first = FALSE;
- for (p = tostr; *p != NUL; p += tolen) {
+ for (p = tostr; *p != '\0'; p += tolen) {
tolen = (*mb_ptr2len)(p);
--idx;
}
@@ -15064,7 +15064,7 @@ error:
/* add a terminating NUL */
ga_grow(&ga, 1);
- ga_append(&ga, NUL);
+ ga_append(&ga, '\0');
rettv->vval.v_string = ga.ga_data;
}
@@ -15112,7 +15112,7 @@ static void f_undofile(typval_T *argvars, typval_T *rettv)
{
char_u *fname = get_tv_string(&argvars[0]);
- if (*fname == NUL) {
+ if (*fname == '\0') {
/* If there is no file name there will be no undo file. */
rettv->vval.v_string = NULL;
} else {
@@ -15186,12 +15186,12 @@ static void f_visualmode(typval_T *argvars, typval_T *rettv)
rettv->v_type = VAR_STRING;
str[0] = curbuf->b_visual_mode_eval;
- str[1] = NUL;
+ str[1] = '\0';
rettv->vval.v_string = vim_strsave(str);
/* A non-zero number or non-empty string argument: reset mode. */
if (non_zero_arg(&argvars[0]))
- curbuf->b_visual_mode_eval = NUL;
+ curbuf->b_visual_mode_eval = '\0';
}
/*
@@ -15278,7 +15278,7 @@ static void f_winrestcmd(typval_T *argvars, typval_T *rettv)
ga_concat(&ga, buf);
++winnr;
}
- ga_append(&ga, NUL);
+ ga_append(&ga, '\0');
rettv->vval.v_string = ga.ga_data;
rettv->v_type = VAR_STRING;
@@ -15386,15 +15386,15 @@ static void f_writefile(typval_T *argvars, typval_T *rettv)
/* Always open the file in binary mode, library functions have a mind of
* their own about CR-LF conversion. */
fname = get_tv_string(&argvars[1]);
- if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) {
- EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("<empty>") : fname);
+ if (*fname == '\0' || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) {
+ EMSG2(_(e_notcreate), *fname == '\0' ? (char_u *)_("<empty>") : fname);
ret = -1;
} else {
for (li = argvars[0].vval.v_list->lv_first; li != NULL;
li = li->li_next) {
- for (s = get_tv_string(&li->li_tv); *s != NUL; ++s) {
+ for (s = get_tv_string(&li->li_tv); *s != '\0'; ++s) {
if (*s == '\n')
- c = putc(NUL, fd);
+ c = putc('\0', fd);
else
c = putc(*s, fd);
if (c == EOF) {
@@ -15490,7 +15490,7 @@ var2fpos (
return NULL;
if (name[0] == '.') /* cursor */
return &curwin->w_cursor;
- if (name[0] == 'v' && name[1] == NUL) { /* Visual start */
+ if (name[0] == 'v' && name[1] == '\0') { /* Visual start */
if (VIsual_active)
return &VIsual;
return &curwin->w_cursor;
@@ -15706,7 +15706,7 @@ static char_u *find_name_end(char_u *arg, char_u **expr_start, char_u **expr_end
if ((flags & FNE_CHECK_START) && !eval_isnamec1(*arg) && *arg != '{')
return arg;
- for (p = arg; *p != NUL
+ for (p = arg; *p != '\0'
&& (eval_isnamec(*p)
|| *p == '{'
|| ((flags & FNE_INCL_BR) && (*p == '[' || *p == '.'))
@@ -15714,16 +15714,16 @@ static char_u *find_name_end(char_u *arg, char_u **expr_start, char_u **expr_end
|| br_nest != 0); mb_ptr_adv(p)) {
if (*p == '\'') {
/* skip over 'string' to avoid counting [ and ] inside it. */
- for (p = p + 1; *p != NUL && *p != '\''; mb_ptr_adv(p))
+ for (p = p + 1; *p != '\0' && *p != '\''; mb_ptr_adv(p))
;
- if (*p == NUL)
+ if (*p == '\0')
break;
} else if (*p == '"') {
/* skip over "str\"ing" to avoid counting [ and ] inside it. */
- for (p = p + 1; *p != NUL && *p != '"'; mb_ptr_adv(p))
- if (*p == '\\' && p[1] != NUL)
+ for (p = p + 1; *p != '\0' && *p != '"'; mb_ptr_adv(p))
+ if (*p == '\\' && p[1] != '\0')
++p;
- if (*p == NUL)
+ if (*p == '\0')
break;
}
@@ -15772,10 +15772,10 @@ static char_u *make_expanded_name(char_u *in_start, char_u *expr_start, char_u *
if (expr_end == NULL || in_end == NULL)
return NULL;
- *expr_start = NUL;
- *expr_end = NUL;
+ *expr_start = '\0';
+ *expr_end = '\0';
c1 = *in_end;
- *in_end = NUL;
+ *in_end = '\0';
temp_result = eval_to_string(expr_start + 1, &nextcmd, FALSE);
if (temp_result != NULL && nextcmd == NULL) {
@@ -15866,10 +15866,10 @@ void set_vim_var_char(int c)
char_u buf[MB_MAXBYTES + 1];
if (has_mbyte)
- buf[(*mb_char2bytes)(c, buf)] = NUL;
+ buf[(*mb_char2bytes)(c, buf)] = '\0';
else {
buf[0] = c;
- buf[1] = NUL;
+ buf[1] = '\0';
}
set_vim_var_string(VV_CHAR, buf, -1);
}
@@ -16011,7 +16011,7 @@ char_u *set_cmdarg(exarg_T *eap, char_u *oldarg)
else if (eap->force_bin == FORCE_NOBIN)
sprintf((char *)newval, " ++nobin");
else
- *newval = NUL;
+ *newval = '\0';
if (eap->read_edit)
STRCAT(newval, " ++edit");
@@ -16053,7 +16053,7 @@ get_var_tv (
/* truncate the name, so that we can use strcmp() */
cc = name[len];
- name[len] = NUL;
+ name[len] = '\0';
/*
* Check for "b:changedtick".
@@ -16405,7 +16405,7 @@ static dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, in
{
hashitem_T *hi;
- if (*varname == NUL) {
+ if (*varname == '\0') {
/* Must be something like "s:", otherwise "ht" would be NULL. */
switch (htname) {
case 's': return &SCRIPT_SV(current_SID)->sv_var;
@@ -16551,7 +16551,7 @@ void init_var_dict(dict_T *dict, dictitem_T *dict_var, int scope)
dict_var->di_tv.v_type = VAR_DICT;
dict_var->di_tv.v_lock = VAR_FIXED;
dict_var->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
- dict_var->di_key[0] = NUL;
+ dict_var->di_key[0] = '\0';
}
/*
@@ -16691,7 +16691,7 @@ set_var (
hashtab_T *ht;
ht = find_var_ht(name, &varname);
- if (ht == NULL || *varname == NUL) {
+ if (ht == NULL || *varname == '\0') {
EMSG2(_(e_illvar), name);
return;
}
@@ -16821,7 +16821,7 @@ var_check_func_name (
)
{
if (!(vim_strchr((char_u *)"wbs", name[0]) != NULL && name[1] == ':')
- && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':')
+ && !ASCII_ISUPPER((name[0] != '\0' && name[1] == ':')
? name[2] : name[0])) {
EMSG2(_("E704: Funcref variable name must start with a capital: %s"),
name);
@@ -16846,7 +16846,7 @@ static int valid_varname(char_u *varname)
{
char_u *p;
- for (p = varname; *p != NUL; ++p)
+ for (p = varname; *p != '\0'; ++p)
if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p))
&& *p != AUTOLOAD_CHAR) {
EMSG2(_(e_illvar), varname);
@@ -17002,7 +17002,7 @@ void ex_echo(exarg_T *eap)
if (eap->skip)
++emsg_skip;
- while (*arg != NUL && *arg != '|' && *arg != '\n' && !got_int) {
+ while (*arg != '\0' && *arg != '|' && *arg != '\n' && !got_int) {
/* If eval1() causes an error message the text from the command may
* still need to be cleared. E.g., "echo 22,44". */
need_clr_eos = needclr;
@@ -17038,7 +17038,7 @@ void ex_echo(exarg_T *eap)
current_copyID += COPYID_INC;
p = echo_string(&rettv, &tofree, numbuf, current_copyID);
if (p != NULL)
- for (; *p != NUL && !got_int; ++p) {
+ for (; *p != '\0' && !got_int; ++p) {
if (*p == '\n' || *p == '\r' || *p == TAB) {
if (*p != TAB && needclr) {
/* remove any text still there from the command */
@@ -17109,7 +17109,7 @@ void ex_execute(exarg_T *eap)
if (eap->skip)
++emsg_skip;
- while (*arg != NUL && *arg != '|' && *arg != '\n') {
+ while (*arg != '\0' && *arg != '|' && *arg != '\n') {
p = arg;
if (eval1(&arg, &rettv, !eap->skip) == FAIL) {
/*
@@ -17184,7 +17184,7 @@ static char_u *find_option_end(char_u **arg, int *opt_flags)
return NULL;
*arg = p;
- if (p[0] == 't' && p[1] == '_' && p[2] != NUL && p[3] != NUL)
+ if (p[0] == 't' && p[1] == '_' && p[2] != '\0' && p[3] != '\0')
p += 4; /* termcap option */
else
while (ASCII_ISALPHA(*p))
@@ -17253,7 +17253,7 @@ void ex_function(exarg_T *eap)
regmatch_T regmatch;
c = *p;
- *p = NUL;
+ *p = '\0';
regmatch.regprog = vim_regcomp(eap->arg + 1, RE_MAGIC);
*p = c;
if (regmatch.regprog != NULL) {
@@ -17325,7 +17325,7 @@ void ex_function(exarg_T *eap)
}
eap->nextcmd = check_nextcmd(p);
if (eap->nextcmd != NULL)
- *p = NUL;
+ *p = '\0';
if (!eap->skip && !got_int) {
fp = find_func(name);
if (fp != NULL) {
@@ -17384,10 +17384,10 @@ void ex_function(exarg_T *eap)
j = 3;
else
j = 0;
- while (arg[j] != NUL && (j == 0 ? eval_isnamec1(arg[j])
+ while (arg[j] != '\0' && (j == 0 ? eval_isnamec1(arg[j])
: eval_isnamec(arg[j])))
++j;
- if (arg[j] != NUL)
+ if (arg[j] != '\0')
emsg_funcname((char *)e_invarg2, arg);
}
/* Disallow using the g: dict. */
@@ -17416,7 +17416,7 @@ void ex_function(exarg_T *eap)
}
ga_grow(&newargs, 1);
c = *p;
- *p = NUL;
+ *p = '\0';
arg = vim_strsave(arg);
if (arg == NULL)
goto erret;
@@ -17466,7 +17466,7 @@ void ex_function(exarg_T *eap)
* Makes 'exe "func Test()\n...\nendfunc"' work. */
if (*p == '\n')
line_arg = p + 1;
- else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg)
+ else if (*p != '\0' && *p != '"' && !eap->skip && !did_emsg)
EMSG(_(e_trailing));
/*
@@ -17507,7 +17507,7 @@ void ex_function(exarg_T *eap)
if (p == NULL)
line_arg += STRLEN(line_arg);
else {
- *p = NUL;
+ *p = '\0';
line_arg = p + 1;
}
} else if (eap->getline == NULL)
@@ -17597,7 +17597,7 @@ void ex_function(exarg_T *eap)
)) {
/* ":python <<" continues until a dot, like ":append" */
p = skipwhite(arg + 2);
- if (*p == NUL)
+ if (*p == '\0')
skip_until = vim_strsave((char_u *)".");
else
skip_until = vim_strsave(p);
@@ -17625,7 +17625,7 @@ void ex_function(exarg_T *eap)
((char_u **)(newlines.ga_data))[newlines.ga_len++] = NULL;
/* Check for end of eap->arg. */
- if (line_arg != NULL && *line_arg == NUL)
+ if (line_arg != NULL && *line_arg == '\0')
line_arg = NULL;
}
@@ -17955,7 +17955,7 @@ trans_function_name (
STRCPY(name + 3, sid_buf);
}
memmove(name + lead, lv.ll_name, (size_t)len);
- name[lead + len] = NUL;
+ name[lead + len] = '\0';
}
*pp = end;
@@ -18081,7 +18081,7 @@ static int function_exists(char_u *name)
/* Only accept "funcname", "funcname ", "funcname (..." and
* "funcname(...", not "funcname!...". */
- if (p != NULL && (*nm == NUL || *nm == '('))
+ if (p != NULL && (*nm == '\0' || *nm == '('))
n = translated_function_exists(p);
vim_free(p);
return n;
@@ -18094,7 +18094,7 @@ char_u *get_expanded_name(char_u *name, int check)
p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET, NULL);
- if (p != NULL && *nm == NUL)
+ if (p != NULL && *nm == '\0')
if (!check || translated_function_exists(p))
return p;
@@ -18349,7 +18349,7 @@ static char_u *autoload_name(char_u *name)
return FALSE;
STRCPY(scriptname, "autoload/");
STRCAT(scriptname, name);
- *vim_strrchr(scriptname, AUTOLOAD_CHAR) = NUL;
+ *vim_strrchr(scriptname, AUTOLOAD_CHAR) = '\0';
STRCAT(scriptname, ".vim");
while ((p = vim_strchr(scriptname, AUTOLOAD_CHAR)) != NULL)
*p = '/';
@@ -18435,7 +18435,7 @@ void ex_delfunction(exarg_T *eap)
}
eap->nextcmd = check_nextcmd(p);
if (eap->nextcmd != NULL)
- *p = NUL;
+ *p = '\0';
if (!eap->skip)
fp = find_func(name);
@@ -18918,7 +18918,7 @@ void ex_return(exarg_T *eap)
++emsg_skip;
eap->nextcmd = NULL;
- if ((*arg != NUL && *arg != '|' && *arg != '\n')
+ if ((*arg != '\0' && *arg != '|' && *arg != '\n')
&& eval0(arg, &rettv, &eap->nextcmd, !eap->skip) != FAIL) {
if (!eap->skip)
returning = do_return(eap, FALSE, TRUE, &rettv);
@@ -19321,7 +19321,7 @@ int store_session_globals(FILE *fd)
(char_u *)"\\\"\n\r");
if (p == NULL) /* out of memory */
break;
- for (t = p; *t != NUL; ++t)
+ for (t = p; *t != '\0'; ++t)
if (*t == '\n')
*t = 'n';
else if (*t == '\r')
@@ -19447,7 +19447,7 @@ repeat:
# ifdef BACKSLASH_IN_FILENAME
|| (*fnamep)[1] == '\\'
# endif
- || (*fnamep)[1] == NUL)
+ || (*fnamep)[1] == '\0')
#endif
) {
@@ -19459,19 +19459,19 @@ repeat:
}
/* When "/." or "/.." is used: force expansion to get rid of it. */
- for (p = *fnamep; *p != NUL; mb_ptr_adv(p)) {
+ for (p = *fnamep; *p != '\0'; mb_ptr_adv(p)) {
if (vim_ispathsep(*p)
&& p[1] == '.'
- && (p[2] == NUL
+ && (p[2] == '\0'
|| vim_ispathsep(p[2])
|| (p[2] == '.'
- && (p[3] == NUL || vim_ispathsep(p[3])))))
+ && (p[3] == '\0' || vim_ispathsep(p[3])))))
break;
}
/* FullName_save() is slow, don't use it when not needed. */
- if (*p != NUL || !vim_isAbsName(*fnamep)) {
- *fnamep = FullName_save(*fnamep, *p != NUL);
+ if (*p != '\0' || !vim_isAbsName(*fnamep)) {
+ *fnamep = FullName_save(*fnamep, *p != '\0');
vim_free(*bufp); /* free any allocated file name */
*bufp = *fnamep;
if (*fnamep == NULL)
@@ -19732,7 +19732,7 @@ char_u *do_string_sub(char_u *str, char_u *pat, char_u *sub, char_u *flags)
+ ga.ga_len + i, TRUE, TRUE, FALSE);
ga.ga_len += i + sublen - 1;
tail = regmatch.endp[0];
- if (*tail == NUL)
+ if (*tail == '\0')
break;
if (!do_all)
break;
@@ -19781,7 +19781,7 @@ static void on_job_data(RStream *rstream, void *data, bool eof, char *type)
char *str = xmalloc(read_count + 1);
rstream_read(rstream, str, read_count);
- str[read_count] = NUL;
+ str[read_count] = '\0';
apply_job_autocmds(job, job_data(job), type, str);
}