diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2014-05-01 14:00:13 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2014-05-01 14:00:31 -0400 |
commit | 1b5217687abf8e1aeabaf4e5a64073177d56e593 (patch) | |
tree | ce4bac12fff08088724bee38bee9d96d33bfe416 /src/eval.c | |
parent | 3b77a62a77970a1c1aff5d50df396171ce24b464 (diff) | |
download | rneovim-1b5217687abf8e1aeabaf4e5a64073177d56e593.tar.gz rneovim-1b5217687abf8e1aeabaf4e5a64073177d56e593.tar.bz2 rneovim-1b5217687abf8e1aeabaf4e5a64073177d56e593.zip |
revert #652
reverting broad cosmetic/style change because:
- increases merge-conflicts
- increases overhead of merging upstream Vim patches
- reasons for change are ambiguous, so default to no change
Diffstat (limited to 'src/eval.c')
-rw-r--r-- | src/eval.c | 386 |
1 files changed, 193 insertions, 193 deletions
diff --git a/src/eval.c b/src/eval.c index 91d74d49e2..df11174898 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 != - '\0') { + NUL) { clear_lval(redir_lval); - if (redir_endp != NULL && *redir_endp != '\0') + if (redir_endp != NULL && *redir_endp != NUL) /* 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, '\0'); /* Append the trailing NUL. */ + ga_append(&redir_ga, NUL); /* 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, '\0'); + ga_append(&ga, NUL); 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] == '\0') { + if (argv[i] == NULL || *argv[i] == NUL) { 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 = '\0'; + *cp = NUL; 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] = '\0'; + op[1] = NUL; 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] != '\0') + if (*arg == '@' && arg[1] != NUL) 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 = '\0'; + *arg = NUL; 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] = '\0'; + name[len] = NUL; 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 = '\0'; + *p = NUL; 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 = '\0'; + *p = NUL; 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 == '\0') { + if (*key == NUL) { if (!quiet) EMSG(_(e_emptykey)); clear_tv(&var1); @@ -2506,7 +2506,7 @@ get_lval ( if (len != -1) { prevval = key[len]; - key[len] = '\0'; + key[len] = NUL; } 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 = '\0'; + *endp = NUL; 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) != '\0' && c != '"') - if (c == '\\' && xp->xp_pattern[1] != '\0') + while ((c = *++xp->xp_pattern) != NUL && c != '"') + if (c == '\\' && xp->xp_pattern[1] != NUL) ++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) != '\0' && c != '\'') + while ((c = *++xp->xp_pattern) != NUL && 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 != '\0') - while ((c = *++arg) != '\0' && (c == ' ' || c == '\t')) + if (*arg != NUL) + while ((c = *++arg) != NUL && (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 = '\0'; + *name_end = NUL; /* 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 != '\0') { + if (ht != NULL && *varname != NUL) { 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 = '\0'; + *name_end = NUL; /* 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 != '\0') + if (**arg != NUL) ++*arg; break; @@ -4788,7 +4788,7 @@ eval_index ( if (len == -1) { key = get_tv_string(&var1); - if (*key == '\0') { + if (*key == NUL) { if (verbose) EMSG(_(e_emptykey)); clear_tv(&var1); @@ -4854,7 +4854,7 @@ get_option_tv ( } c = *option_end; - *option_end = '\0'; + *option_end = NUL; 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 != '\0' && *p != '"'; mb_ptr_adv(p)) { - if (*p == '\\' && p[1] != '\0') { + for (p = *arg + 1; *p != NUL && *p != '"'; mb_ptr_adv(p)) { + if (*p == '\\' && p[1] != NUL) { ++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 != '\0' && *p != '"'; ) { + for (p = *arg + 1; *p != NUL && *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 = '\0'; + *name = NUL; *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 != '\0'; mb_ptr_adv(p)) { + for (p = *arg + 1; *p != NUL; 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 != '\0'; ) { + for (p = *arg + 1; *p != NUL; ) { 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 = '\0'; + *str = NUL; *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 != '\0') { + while (**arg != ']' && **arg != NUL) { 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, '\0'); + ga_append(&ga, NUL); 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, '\0'); + ga_append(&ga, NUL); 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 != '\0') { + while (**arg != '}' && **arg != NUL) { 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 == '\0') { + if (key == NULL || *key == NUL) { /* "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 != '\0'; mb_ptr_adv(p)) + for (p = str; *p != NUL; 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 != '\0'; ) { + for (p = str; *p != NUL; ) { 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++ = '\0'; + *r++ = NUL; } return s; } @@ -6742,10 +6742,10 @@ static int get_env_tv(char_u **arg, typval_T *rettv, int evaluate) return FAIL; // Can't be an environment variable. } cc = name[len]; - name[len] = '\0'; + name[len] = NUL; // First try vim_getenv(), fast for normal environment vars. string = vim_getenv(name, &mustfree); - if (string != NULL && *string != '\0') { + if (string != NULL && *string != NUL) { if (!mustfree) { string = vim_strsave(string); } @@ -7141,7 +7141,7 @@ static char_u *deref_func_name(char_u *name, int *lenp, int no_autoload) int cc; cc = name[*lenp]; - name[*lenp] = '\0'; + name[*lenp] = NUL; v = find_var(name, NULL, no_autoload); name[*lenp] = cc; if (v != NULL && v->di_tv.v_type == VAR_FUNC) { @@ -7184,7 +7184,7 @@ get_func_tv ( argp = *arg; while (argcount < MAX_FUNC_ARGS) { argp = skipwhite(argp + 1); /* skip the '(' or ',' */ - if (*argp == ')' || *argp == ',' || *argp == '\0') + if (*argp == ')' || *argp == ',' || *argp == NUL) break; if (eval1(&argp, &argvars[argcount], evaluate) == FAIL) { ret = FAIL; @@ -7452,7 +7452,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 != '\0'); + && *argvars[0].vval.v_string != NUL); } /********************************************* @@ -7770,9 +7770,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 == '\0') + if (name == NULL || *name == NUL) return curbuf; - if (name[0] == '$' && name[1] == '\0') + if (name[0] == '$' && name[1] == NUL) return lastbuf; /* Ignore 'magic' and 'cpoptions' here to make scripts portable */ @@ -7892,7 +7892,7 @@ static void byteidx(typval_T *argvars, typval_T *rettv, int comp) t = str; for (; idx > 0; idx--) { - if (*t == '\0') /* EOL reached */ + if (*t == NUL) /* EOL reached */ return; if (enc_utf8 && comp) t += utf_ptr2len(t); @@ -7969,7 +7969,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 == '\0') + if (*func == NUL) return; /* type error or empty name */ if (argvars[2].v_type != VAR_UNKNOWN) { @@ -8078,7 +8078,7 @@ static void f_col(typval_T *argvars, typval_T *rettv) curwin->w_virtcol - curwin->w_cursor.coladd)) { int l; - if (*p != '\0' && p[(l = (*mb_ptr2len)(p))] == '\0') + if (*p != NUL && p[(l = (*mb_ptr2len)(p))] == NUL) col += l; } } @@ -8177,7 +8177,7 @@ static void f_confirm(typval_T *argvars, typval_T *rettv) } } - if (buttons == NULL || *buttons == '\0') + if (buttons == NULL || *buttons == NUL) buttons = (char_u *)_("&Ok"); if (!error) @@ -8457,7 +8457,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 == '\0'; + || *argvars[0].vval.v_string == NUL; break; case VAR_NUMBER: n = argvars[0].vval.v_number == 0; @@ -8507,7 +8507,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 != '\0') + } else if (*s != NUL) EMSG(_(e_trailing)); } @@ -8551,7 +8551,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) != '\0') + if (*skipwhite(p) != NUL) n = FALSE; /* trailing garbage */ } else if (*p == '*') { /* internal or user defined function */ n = function_exists(p + 1); @@ -8580,7 +8580,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv) clear_tv(&tv); } } - if (*p != '\0') + if (*p != NUL) n = FALSE; vim_free(tofree); @@ -8799,10 +8799,10 @@ static void f_feedkeys(typval_T *argvars, typval_T *rettv) return; keys = get_tv_string(&argvars[0]); - if (*keys != '\0') { + if (*keys != NUL) { if (argvars[1].v_type != VAR_UNKNOWN) { flags = get_tv_string_buf(&argvars[1], nbuf); - for (; *flags != '\0'; ++flags) { + for (; *flags != NUL; ++flags) { switch (*flags) { case 'n': remap = FALSE; break; case 'm': remap = TRUE; break; @@ -8864,7 +8864,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 == '\0' ? p_path : curbuf->b_p_path; + char_u *path = *curbuf->b_p_path == NUL ? p_path : curbuf->b_p_path; char_u *p; char_u pathbuf[NUMBUFLEN]; int count = 1; @@ -8881,7 +8881,7 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what) if (p == NULL) error = TRUE; else { - if (*p != '\0') + if (*p != NUL) path = p; if (argvars[2].v_type != VAR_UNKNOWN) @@ -8893,7 +8893,7 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what) rettv_list_alloc(rettv); } - if (*fname != '\0' && !error) { + if (*fname != NUL && !error) { do { if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST) vim_free(fresult); @@ -9028,7 +9028,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 != '\0') { /* check for trailing chars after expr */ + if (*s != NUL) { /* check for trailing chars after expr */ EMSG2(_(e_invexpr2), s); goto theend; } @@ -9244,7 +9244,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) == '\0' + if (*skipwhite(s) == NUL && lnum + 1 < (linenr_T)vimvars[VV_FOLDEND].vv_nr) { s = skipwhite(ml_get(lnum + 1)); if (*s == '*') @@ -9311,7 +9311,7 @@ static void f_function(typval_T *argvars, typval_T *rettv) char_u *s; s = get_tv_string(&argvars[0]); - if (s == NULL || *s == '\0' || VIM_ISDIGIT(*s)) + if (s == NULL || *s == NUL || 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)) @@ -9526,7 +9526,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() == '\0') + else if (error || vpeekc() == NUL) /* illegal argument or getchar(0) and no char avail: return zero */ n = 0; else @@ -9562,7 +9562,7 @@ static void f_getchar(typval_T *argvars, typval_T *rettv) i += (*mb_char2bytes)(n, temp + i); else temp[i++] = n; - temp[i++] = '\0'; + temp[i++] = NUL; rettv->v_type = VAR_STRING; rettv->vval.v_string = vim_strsave(temp); @@ -9623,7 +9623,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] = '\0'; + rettv->vval.v_string[1] = NUL; } } @@ -9938,8 +9938,8 @@ static void f_getregtype(typval_T *argvars, typval_T *rettv) if (regname == 0) regname = '"'; - buf[0] = '\0'; - buf[1] = '\0'; + buf[0] = NUL; + buf[1] = NUL; switch (get_reg_type(regname, ®len)) { case MLINE: buf[0] = 'V'; break; case MCHAR: buf[0] = 'v'; break; @@ -10413,9 +10413,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 != '\0') { + if (*str != NUL) { init_history(); - add_to_history(histype, str, FALSE, '\0'); + add_to_history(histype, str, FALSE, NUL); rettv->vval.v_number = TRUE; return; } @@ -10641,7 +10641,7 @@ static void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog) else { ++p; c = *p; - *p = '\0'; + *p = NUL; msg_start(); msg_clr_eos(); msg_puts_attr(prompt, echo_attr); @@ -10680,7 +10680,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 ? '\0' : '@', p, echo_attr, + getcmdline_prompt(inputsecret_flag ? NUL : '@', p, echo_attr, xp_type, xp_arg); ex_normal_busy = save_ex_normal_busy; } @@ -10861,7 +10861,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 != '\0') + if (*end != NUL) EMSG(_(e_trailing)); else { if (lv.ll_tv == NULL) { @@ -11132,7 +11132,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, '\0'); + ga_append(&ga, NUL); rettv->vval.v_string = (char_u *)ga.ga_data; } else rettv->vval.v_string = NULL; @@ -11316,7 +11316,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 == '\0') + if (*keys == NUL) return; if (argvars[1].v_type != VAR_UNKNOWN) { @@ -11781,12 +11781,12 @@ static void f_mkdir(typval_T *argvars, typval_T *rettv) return; dir = get_tv_string_buf(&argvars[0], buf); - if (*dir == '\0') + if (*dir == NUL) rettv->vval.v_number = FAIL; else { - if (*path_tail(dir) == '\0') + if (*path_tail(dir) == NUL) /* remove trailing slashes */ - *path_tail_with_sep(dir) = '\0'; + *path_tail_with_sep(dir) = NUL; if (argvars[1].v_type != VAR_UNKNOWN) { if (argvars[2].v_type != VAR_UNKNOWN) @@ -11805,8 +11805,8 @@ static void f_mode(typval_T *argvars, typval_T *rettv) { char_u buf[3]; - buf[1] = '\0'; - buf[2] = '\0'; + buf[1] = NUL; + buf[2] = NUL; if (VIsual_active) { if (VIsual_select) @@ -11846,7 +11846,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] = '\0'; + buf[1] = NUL; rettv->vval.v_string = vim_strsave(buf); rettv->v_type = VAR_STRING; @@ -11865,7 +11865,7 @@ static void f_nextnonblank(typval_T *argvars, typval_T *rettv) lnum = 0; break; } - if (*skipwhite(ml_get(lnum)) != '\0') + if (*skipwhite(ml_get(lnum)) != NUL) break; } rettv->vval.v_number = lnum; @@ -11884,12 +11884,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)] = '\0'; + buf[(*utf_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; else - buf[(*mb_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = '\0'; + buf[(*mb_char2bytes)((int)get_tv_number(&argvars[0]), buf)] = NUL; } else { buf[0] = (char_u)get_tv_number(&argvars[0]); - buf[1] = '\0'; + buf[1] = NUL; } rettv->v_type = VAR_STRING; rettv->vval.v_string = vim_strsave(buf); @@ -11949,7 +11949,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)) == '\0') + while (lnum >= 1 && *skipwhite(ml_get(lnum)) == NUL) --lnum; rettv->vval.v_number = lnum; } @@ -12067,8 +12067,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 == '\0' || (fd = mch_fopen((char *)fname, READBIN)) == NULL) { - EMSG2(_(e_notopen), *fname == '\0' ? (char_u *)_("<empty>") : fname); + if (*fname == NUL || (fd = mch_fopen((char *)fname, READBIN)) == NULL) { + EMSG2(_(e_notopen), *fname == NUL ? (char_u *)_("<empty>") : fname); return; } @@ -12105,7 +12105,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] = '\0'; + s[prevlen + len] = NUL; prev = NULL; /* the list will own the string */ prevlen = prevsize = 0; } @@ -12129,7 +12129,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 == '\0') + } else if (*p == NUL) *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. */ @@ -12137,10 +12137,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] : '\0'; + : prevlen >= 1 ? prev[prevlen - 1] : NUL; char_u back2 = p >= buf + 2 ? p[-2] : p == buf + 1 && prevlen >= 1 ? prev[prevlen - 1] - : prevlen >= 2 ? prev[prevlen - 2] : '\0'; + : prevlen >= 2 ? prev[prevlen - 2] : NUL; if (back2 == 0xef && back1 == 0xbb) { char_u *dest = p - 2; @@ -12461,7 +12461,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] = '\0'; + r[len] = NUL; } rettv->vval.v_string = r; @@ -12509,15 +12509,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] = '\0'; /* the trailing slash breaks readlink() */ + p[len - 1] = NUL; /* the trailing slash breaks readlink() */ } q = path_next_component(p); - if (*q != '\0') { + if (*q != NUL) { /* Separate the first path component in "p", and keep the * remainder (beginning with the path separator). */ remain = vim_strsave(q - 1); - q[-1] = '\0'; + q[-1] = NUL; } buf = alloc(MAXPATHL + 1); @@ -12529,7 +12529,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv) len = readlink((char *)p, (char *)buf, MAXPATHL); if (len <= 0) break; - buf[len] = '\0'; + buf[len] = NUL; if (limit-- == 0) { vim_free(p); @@ -12547,7 +12547,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 != '\0') { + if (*q != NUL) { if (remain == NULL) remain = vim_strsave(q - 1); else { @@ -12557,13 +12557,13 @@ static void f_resolve(typval_T *argvars, typval_T *rettv) remain = cpy; } } - q[-1] = '\0'; + q[-1] = NUL; } q = path_tail(p); - if (q > p && *q == '\0') { + if (q > p && *q == NUL) { /* Ignore trailing path separator. */ - q[-1] = '\0'; + q[-1] = NUL; q = path_tail(p); } if (q > p && !path_is_absolute_path(buf)) { @@ -12586,7 +12586,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 != '\0'); + len = q - remain - (*q != NUL); cpy = vim_strnsave(p, STRLEN(p) + len); if (cpy != NULL) { STRNCAT(cpy, remain, len); @@ -12594,7 +12594,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv) p = cpy; } /* Shorten "remain". */ - if (*q != '\0') + if (*q != NUL) STRMOVE(remain, q - 1); else { vim_free(remain); @@ -12606,12 +12606,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 != '\0' + && *p != NUL && !(p[0] == '.' - && (p[1] == '\0' + && (p[1] == NUL || vim_ispathsep(p[1]) || (p[1] == '.' - && (p[2] == '\0' + && (p[2] == NUL || vim_ispathsep(p[2])))))) { /* Prepend "./". */ cpy = concat_str((char_u *)"./", p); @@ -12634,7 +12634,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) = '\0'; + *path_tail_with_sep(p) = NUL; } rettv->vval.v_string = p; @@ -12706,7 +12706,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 != '\0') { + while (*flags != NUL) { switch (*flags) { case 'b': dir = BACKWARD; break; case 'w': p_ws = TRUE; break; @@ -13087,7 +13087,7 @@ do_searchpair ( if (pat2 == NULL || pat3 == NULL) goto theend; sprintf((char *)pat2, "\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat); - if (*mpat == '\0') + if (*mpat == NUL) STRCPY(pat3, pat2); else sprintf((char *)pat3, "\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)", @@ -13124,7 +13124,7 @@ do_searchpair ( options &= ~SEARCH_START; /* If the skip pattern matches, ignore this match. */ - if (*skip != '\0') { + if (*skip != NUL) { save_pos = curwin->w_cursor; curwin->w_cursor = pos; r = eval_to_bool(skip, &err, NULL, FALSE); @@ -13460,7 +13460,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] == '\0') { + if (name[0] == '.' && name[1] == NUL) { /* set cursor */ if (fnum == curbuf->b_fnum) { curwin->w_cursor = pos; @@ -13468,7 +13468,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] != '\0' && name[2] == '\0') { + } else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) { /* set mark */ if (setmark_pos(name[1], &pos, fnum) == OK) rettv->vval.v_number = 0; @@ -13518,7 +13518,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 != '\0'; ++stropt) + for (; *stropt != NUL; ++stropt) switch (*stropt) { case 'a': case 'A': /* append */ append = TRUE; @@ -13964,13 +13964,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 != '\0') { + } else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL) { char_u *str = get_tv_string_chk(&argvars[0]); int capcol = -1; if (str != NULL) { /* Check the argument for spelling. */ - while (*str != '\0') { + while (*str != NUL) { len = spell_check(curwin, str, &attr, &capcol, FALSE); if (attr != HLF_COUNT) { word = str; @@ -14005,7 +14005,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 != '\0') { + if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) { str = get_tv_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) { maxcount = get_tv_number_chk(&argvars[1], &typeerr); @@ -14063,7 +14063,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 == '\0') + if (pat == NULL || *pat == NUL) pat = (char_u *)"[\\x01- ]\\+"; rettv_list_alloc(rettv); @@ -14074,8 +14074,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 != '\0' || keepempty) { - if (*str == '\0') + while (*str != NUL || keepempty) { + if (*str == NUL) match = FALSE; /* empty item at the end */ else match = vim_regexec_nl(®match, str, col); @@ -14084,7 +14084,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 != '\0' && match && end < + && *str != NUL && match && end < regmatch.endp[0])) { list_append_string(rettv->vval.v_list, str, (int)(end - str)); } @@ -14191,7 +14191,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] = '\0'; + result_buf[0] = NUL; if (conv.vc_type != CONV_NONE) vim_free(p); @@ -14272,7 +14272,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 != '\0') { + while (*s != NUL) { mb_cptr2char_adv(&s); ++len; } @@ -14373,11 +14373,11 @@ static void f_strridx(typval_T *argvars, typval_T *rettv) } else end_idx = haystack_len; - if (*needle == '\0') { + if (*needle == NUL) { /* Empty string matches past the end. */ lastmatch = haystack + end_idx; } else { - for (rest = haystack; *rest != '\0'; ++rest) { + for (rest = haystack; *rest != NUL; ++rest) { rest = (char_u *)strstr((char *)rest, (char *)needle); if (rest == NULL || rest > haystack + end_idx) break; @@ -14584,7 +14584,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, '\0', sizeof(str)); + memset(str, NUL, sizeof(str)); rettv_list_alloc(rettv); if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count && col >= 0 @@ -14595,10 +14595,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 == '\0' && curwin->w_p_cole == 1 && lcs_conceal != '\0') { + if (cchar == NUL && curwin->w_p_cole == 1 && lcs_conceal != NUL) { cchar = lcs_conceal; } - if (cchar != '\0') { + if (cchar != NUL) { if (has_mbyte) (*mb_char2bytes)(cchar, str); else @@ -14712,7 +14712,7 @@ static void f_system(typval_T *argvars, typval_T *rettv) ++s; *d++ = *s; } - *d = '\0'; + *d = NUL; } # endif #endif @@ -14864,7 +14864,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 == '\0') + if (*tag_pattern == NUL) return; rettv_list_alloc(rettv); @@ -14942,7 +14942,7 @@ static void f_tolower(typval_T *argvars, typval_T *rettv) rettv->vval.v_string = p; if (p != NULL) - while (*p != '\0') { + while (*p != NUL) { int l; if (enc_utf8) { @@ -15014,16 +15014,16 @@ error: } /* fromstr and tostr have to contain the same number of chars */ - while (*in_str != '\0') { + while (*in_str != NUL) { if (has_mbyte) { inlen = (*mb_ptr2len)(in_str); cpstr = in_str; cplen = inlen; idx = 0; - for (p = fromstr; *p != '\0'; p += fromlen) { + for (p = fromstr; *p != NUL; p += fromlen) { fromlen = (*mb_ptr2len)(p); if (fromlen == inlen && STRNCMP(in_str, p, inlen) == 0) { - for (p = tostr; *p != '\0'; p += tolen) { + for (p = tostr; *p != NUL; p += tolen) { tolen = (*mb_ptr2len)(p); if (idx-- == 0) { cplen = tolen; @@ -15031,7 +15031,7 @@ error: break; } } - if (*p == '\0') /* tostr is shorter than fromstr */ + if (*p == NUL) /* tostr is shorter than fromstr */ goto error; break; } @@ -15043,7 +15043,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 != '\0'; p += tolen) { + for (p = tostr; *p != NUL; p += tolen) { tolen = (*mb_ptr2len)(p); --idx; } @@ -15069,7 +15069,7 @@ error: /* add a terminating NUL */ ga_grow(&ga, 1); - ga_append(&ga, '\0'); + ga_append(&ga, NUL); rettv->vval.v_string = ga.ga_data; } @@ -15117,7 +15117,7 @@ static void f_undofile(typval_T *argvars, typval_T *rettv) { char_u *fname = get_tv_string(&argvars[0]); - if (*fname == '\0') { + if (*fname == NUL) { /* If there is no file name there will be no undo file. */ rettv->vval.v_string = NULL; } else { @@ -15191,12 +15191,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] = '\0'; + str[1] = NUL; 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 = '\0'; + curbuf->b_visual_mode_eval = NUL; } /* @@ -15283,7 +15283,7 @@ static void f_winrestcmd(typval_T *argvars, typval_T *rettv) ga_concat(&ga, buf); ++winnr; } - ga_append(&ga, '\0'); + ga_append(&ga, NUL); rettv->vval.v_string = ga.ga_data; rettv->v_type = VAR_STRING; @@ -15391,15 +15391,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 == '\0' || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) { - EMSG2(_(e_notcreate), *fname == '\0' ? (char_u *)_("<empty>") : fname); + if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) { + EMSG2(_(e_notcreate), *fname == NUL ? (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 != '\0'; ++s) { + for (s = get_tv_string(&li->li_tv); *s != NUL; ++s) { if (*s == '\n') - c = putc('\0', fd); + c = putc(NUL, fd); else c = putc(*s, fd); if (c == EOF) { @@ -15495,7 +15495,7 @@ var2fpos ( return NULL; if (name[0] == '.') /* cursor */ return &curwin->w_cursor; - if (name[0] == 'v' && name[1] == '\0') { /* Visual start */ + if (name[0] == 'v' && name[1] == NUL) { /* Visual start */ if (VIsual_active) return &VIsual; return &curwin->w_cursor; @@ -15711,7 +15711,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 != '\0' + for (p = arg; *p != NUL && (eval_isnamec(*p) || *p == '{' || ((flags & FNE_INCL_BR) && (*p == '[' || *p == '.')) @@ -15719,16 +15719,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 != '\0' && *p != '\''; mb_ptr_adv(p)) + for (p = p + 1; *p != NUL && *p != '\''; mb_ptr_adv(p)) ; - if (*p == '\0') + if (*p == NUL) break; } else if (*p == '"') { /* skip over "str\"ing" to avoid counting [ and ] inside it. */ - for (p = p + 1; *p != '\0' && *p != '"'; mb_ptr_adv(p)) - if (*p == '\\' && p[1] != '\0') + for (p = p + 1; *p != NUL && *p != '"'; mb_ptr_adv(p)) + if (*p == '\\' && p[1] != NUL) ++p; - if (*p == '\0') + if (*p == NUL) break; } @@ -15777,10 +15777,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 = '\0'; - *expr_end = '\0'; + *expr_start = NUL; + *expr_end = NUL; c1 = *in_end; - *in_end = '\0'; + *in_end = NUL; temp_result = eval_to_string(expr_start + 1, &nextcmd, FALSE); if (temp_result != NULL && nextcmd == NULL) { @@ -15871,10 +15871,10 @@ void set_vim_var_char(int c) char_u buf[MB_MAXBYTES + 1]; if (has_mbyte) - buf[(*mb_char2bytes)(c, buf)] = '\0'; + buf[(*mb_char2bytes)(c, buf)] = NUL; else { buf[0] = c; - buf[1] = '\0'; + buf[1] = NUL; } set_vim_var_string(VV_CHAR, buf, -1); } @@ -16016,7 +16016,7 @@ char_u *set_cmdarg(exarg_T *eap, char_u *oldarg) else if (eap->force_bin == FORCE_NOBIN) sprintf((char *)newval, " ++nobin"); else - *newval = '\0'; + *newval = NUL; if (eap->read_edit) STRCAT(newval, " ++edit"); @@ -16058,7 +16058,7 @@ get_var_tv ( /* truncate the name, so that we can use strcmp() */ cc = name[len]; - name[len] = '\0'; + name[len] = NUL; /* * Check for "b:changedtick". @@ -16410,7 +16410,7 @@ static dictitem_T *find_var_in_ht(hashtab_T *ht, int htname, char_u *varname, in { hashitem_T *hi; - if (*varname == '\0') { + if (*varname == NUL) { /* Must be something like "s:", otherwise "ht" would be NULL. */ switch (htname) { case 's': return &SCRIPT_SV(current_SID)->sv_var; @@ -16556,7 +16556,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] = '\0'; + dict_var->di_key[0] = NUL; } /* @@ -16696,7 +16696,7 @@ set_var ( hashtab_T *ht; ht = find_var_ht(name, &varname); - if (ht == NULL || *varname == '\0') { + if (ht == NULL || *varname == NUL) { EMSG2(_(e_illvar), name); return; } @@ -16826,7 +16826,7 @@ var_check_func_name ( ) { if (!(vim_strchr((char_u *)"wbs", name[0]) != NULL && name[1] == ':') - && !ASCII_ISUPPER((name[0] != '\0' && name[1] == ':') + && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') ? name[2] : name[0])) { EMSG2(_("E704: Funcref variable name must start with a capital: %s"), name); @@ -16851,7 +16851,7 @@ static int valid_varname(char_u *varname) { char_u *p; - for (p = varname; *p != '\0'; ++p) + for (p = varname; *p != NUL; ++p) if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p)) && *p != AUTOLOAD_CHAR) { EMSG2(_(e_illvar), varname); @@ -17007,7 +17007,7 @@ void ex_echo(exarg_T *eap) if (eap->skip) ++emsg_skip; - while (*arg != '\0' && *arg != '|' && *arg != '\n' && !got_int) { + while (*arg != NUL && *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; @@ -17043,7 +17043,7 @@ void ex_echo(exarg_T *eap) current_copyID += COPYID_INC; p = echo_string(&rettv, &tofree, numbuf, current_copyID); if (p != NULL) - for (; *p != '\0' && !got_int; ++p) { + for (; *p != NUL && !got_int; ++p) { if (*p == '\n' || *p == '\r' || *p == TAB) { if (*p != TAB && needclr) { /* remove any text still there from the command */ @@ -17114,7 +17114,7 @@ void ex_execute(exarg_T *eap) if (eap->skip) ++emsg_skip; - while (*arg != '\0' && *arg != '|' && *arg != '\n') { + while (*arg != NUL && *arg != '|' && *arg != '\n') { p = arg; if (eval1(&arg, &rettv, !eap->skip) == FAIL) { /* @@ -17189,7 +17189,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] != '\0' && p[3] != '\0') + if (p[0] == 't' && p[1] == '_' && p[2] != NUL && p[3] != NUL) p += 4; /* termcap option */ else while (ASCII_ISALPHA(*p)) @@ -17258,7 +17258,7 @@ void ex_function(exarg_T *eap) regmatch_T regmatch; c = *p; - *p = '\0'; + *p = NUL; regmatch.regprog = vim_regcomp(eap->arg + 1, RE_MAGIC); *p = c; if (regmatch.regprog != NULL) { @@ -17330,7 +17330,7 @@ void ex_function(exarg_T *eap) } eap->nextcmd = check_nextcmd(p); if (eap->nextcmd != NULL) - *p = '\0'; + *p = NUL; if (!eap->skip && !got_int) { fp = find_func(name); if (fp != NULL) { @@ -17389,10 +17389,10 @@ void ex_function(exarg_T *eap) j = 3; else j = 0; - while (arg[j] != '\0' && (j == 0 ? eval_isnamec1(arg[j]) + while (arg[j] != NUL && (j == 0 ? eval_isnamec1(arg[j]) : eval_isnamec(arg[j]))) ++j; - if (arg[j] != '\0') + if (arg[j] != NUL) emsg_funcname((char *)e_invarg2, arg); } /* Disallow using the g: dict. */ @@ -17421,7 +17421,7 @@ void ex_function(exarg_T *eap) } ga_grow(&newargs, 1); c = *p; - *p = '\0'; + *p = NUL; arg = vim_strsave(arg); if (arg == NULL) goto erret; @@ -17471,7 +17471,7 @@ void ex_function(exarg_T *eap) * Makes 'exe "func Test()\n...\nendfunc"' work. */ if (*p == '\n') line_arg = p + 1; - else if (*p != '\0' && *p != '"' && !eap->skip && !did_emsg) + else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) EMSG(_(e_trailing)); /* @@ -17512,7 +17512,7 @@ void ex_function(exarg_T *eap) if (p == NULL) line_arg += STRLEN(line_arg); else { - *p = '\0'; + *p = NUL; line_arg = p + 1; } } else if (eap->getline == NULL) @@ -17602,7 +17602,7 @@ void ex_function(exarg_T *eap) )) { /* ":python <<" continues until a dot, like ":append" */ p = skipwhite(arg + 2); - if (*p == '\0') + if (*p == NUL) skip_until = vim_strsave((char_u *)"."); else skip_until = vim_strsave(p); @@ -17630,7 +17630,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 == '\0') + if (line_arg != NULL && *line_arg == NUL) line_arg = NULL; } @@ -17960,7 +17960,7 @@ trans_function_name ( STRCPY(name + 3, sid_buf); } memmove(name + lead, lv.ll_name, (size_t)len); - name[lead + len] = '\0'; + name[lead + len] = NUL; } *pp = end; @@ -18086,7 +18086,7 @@ static int function_exists(char_u *name) /* Only accept "funcname", "funcname ", "funcname (..." and * "funcname(...", not "funcname!...". */ - if (p != NULL && (*nm == '\0' || *nm == '(')) + if (p != NULL && (*nm == NUL || *nm == '(')) n = translated_function_exists(p); vim_free(p); return n; @@ -18099,7 +18099,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 == '\0') + if (p != NULL && *nm == NUL) if (!check || translated_function_exists(p)) return p; @@ -18354,7 +18354,7 @@ static char_u *autoload_name(char_u *name) return FALSE; STRCPY(scriptname, "autoload/"); STRCAT(scriptname, name); - *vim_strrchr(scriptname, AUTOLOAD_CHAR) = '\0'; + *vim_strrchr(scriptname, AUTOLOAD_CHAR) = NUL; STRCAT(scriptname, ".vim"); while ((p = vim_strchr(scriptname, AUTOLOAD_CHAR)) != NULL) *p = '/'; @@ -18440,7 +18440,7 @@ void ex_delfunction(exarg_T *eap) } eap->nextcmd = check_nextcmd(p); if (eap->nextcmd != NULL) - *p = '\0'; + *p = NUL; if (!eap->skip) fp = find_func(name); @@ -18923,7 +18923,7 @@ void ex_return(exarg_T *eap) ++emsg_skip; eap->nextcmd = NULL; - if ((*arg != '\0' && *arg != '|' && *arg != '\n') + if ((*arg != NUL && *arg != '|' && *arg != '\n') && eval0(arg, &rettv, &eap->nextcmd, !eap->skip) != FAIL) { if (!eap->skip) returning = do_return(eap, FALSE, TRUE, &rettv); @@ -19218,7 +19218,7 @@ int read_viminfo_varlist(vir_T *virp, int writing) if (!writing && (find_viminfo_parameter('!') != NULL)) { tab = vim_strchr(virp->vir_line + 1, '\t'); if (tab != NULL) { - *tab++ = '\0'; /* isolate the variable name */ + *tab++ = NUL; /* isolate the variable name */ switch (*tab) { case 'S': type = VAR_STRING; break; case 'F': type = VAR_FLOAT; break; @@ -19326,7 +19326,7 @@ int store_session_globals(FILE *fd) (char_u *)"\\\"\n\r"); if (p == NULL) /* out of memory */ break; - for (t = p; *t != '\0'; ++t) + for (t = p; *t != NUL; ++t) if (*t == '\n') *t = 'n'; else if (*t == '\r') @@ -19452,7 +19452,7 @@ repeat: # ifdef BACKSLASH_IN_FILENAME || (*fnamep)[1] == '\\' # endif - || (*fnamep)[1] == '\0') + || (*fnamep)[1] == NUL) #endif ) { @@ -19464,19 +19464,19 @@ repeat: } /* When "/." or "/.." is used: force expansion to get rid of it. */ - for (p = *fnamep; *p != '\0'; mb_ptr_adv(p)) { + for (p = *fnamep; *p != NUL; mb_ptr_adv(p)) { if (vim_ispathsep(*p) && p[1] == '.' - && (p[2] == '\0' + && (p[2] == NUL || vim_ispathsep(p[2]) || (p[2] == '.' - && (p[3] == '\0' || vim_ispathsep(p[3]))))) + && (p[3] == NUL || vim_ispathsep(p[3]))))) break; } /* FullName_save() is slow, don't use it when not needed. */ - if (*p != '\0' || !vim_isAbsName(*fnamep)) { - *fnamep = FullName_save(*fnamep, *p != '\0'); + if (*p != NUL || !vim_isAbsName(*fnamep)) { + *fnamep = FullName_save(*fnamep, *p != NUL); vim_free(*bufp); /* free any allocated file name */ *bufp = *fnamep; if (*fnamep == NULL) @@ -19737,7 +19737,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 == '\0') + if (*tail == NUL) break; if (!do_all) break; @@ -19786,7 +19786,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] = '\0'; + str[read_count] = NUL; apply_job_autocmds(job, job_data(job), type, str); } |