aboutsummaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2014-04-29 21:56:49 +0200
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-29 17:51:09 -0300
commit2e4613aecc712eb5e893d341da5f571f932376d5 (patch)
tree41f6b1c751181319d88cc0fdb7aed61bf732701d /src/eval.c
parent046debb9359c85e2f2bc5c6d9481dac0025c6a80 (diff)
downloadrneovim-2e4613aecc712eb5e893d341da5f571f932376d5.tar.gz
rneovim-2e4613aecc712eb5e893d341da5f571f932376d5.tar.bz2
rneovim-2e4613aecc712eb5e893d341da5f571f932376d5.zip
Remove NUL macro
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'