summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-03-12 19:22:36 +0100
committerBram Moolenaar <Bram@vim.org>2017-03-12 19:22:36 +0100
commit91acfffc1e6c0d8c2abfb186a0e79a5bf19c3f3f (patch)
tree1923145c992a09b3adc06e40f02284ff0ef21bbd
parent47ffb905f363571072faefbd417938e7ff351a9f (diff)
patch 8.0.0451: some macros are in lower casev8.0.0451
Problem: Some macros are in lower case. Solution: Make a few more macros upper case. Avoid lower case macros use an argument twice.
-rw-r--r--src/charset.c20
-rw-r--r--src/edit.c20
-rw-r--r--src/eval.c22
-rw-r--r--src/ex_cmds.c2
-rw-r--r--src/ex_cmds2.c2
-rw-r--r--src/ex_docmd.c16
-rw-r--r--src/ex_getln.c4
-rw-r--r--src/fileio.c2
-rw-r--r--src/fold.c4
-rw-r--r--src/gui.c2
-rw-r--r--src/gui_gtk.c2
-rw-r--r--src/macros.h31
-rw-r--r--src/mark.c2
-rw-r--r--src/mbyte.c3
-rw-r--r--src/memline.c6
-rw-r--r--src/menu.c8
-rw-r--r--src/message.c2
-rw-r--r--src/misc1.c20
-rw-r--r--src/misc2.c21
-rw-r--r--src/ops.c14
-rw-r--r--src/option.c12
-rw-r--r--src/os_amiga.c4
-rw-r--r--src/os_mswin.c8
-rw-r--r--src/os_unix.c4
-rw-r--r--src/os_win32.c2
-rw-r--r--src/popupmnu.c4
-rw-r--r--src/proto/misc2.pro2
-rw-r--r--src/regexp.c28
-rw-r--r--src/regexp_nfa.c20
-rw-r--r--src/screen.c8
-rw-r--r--src/search.c8
-rw-r--r--src/spell.c62
-rw-r--r--src/spellfile.c14
-rw-r--r--src/syntax.c8
-rw-r--r--src/tag.c6
-rw-r--r--src/ui.c2
-rw-r--r--src/undo.c2
-rw-r--r--src/version.c2
-rw-r--r--src/window.c2
39 files changed, 207 insertions, 194 deletions
diff --git a/src/charset.c b/src/charset.c
index 1e1b8b1af8..18a693547d 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -870,7 +870,7 @@ win_linetabsize(win_T *wp, char_u *line, colnr_T len)
char_u *s;
for (s = line; *s != NUL && (len == MAXCOL || s < line + len);
- mb_ptr_adv(s))
+ MB_PTR_ADV(s))
col += win_lbr_chartabsize(wp, line, s, col, NULL);
return (int)col;
}
@@ -1026,7 +1026,7 @@ lbr_chartabsize_adv(
int retval;
retval = lbr_chartabsize(line, *s, col);
- mb_ptr_adv(*s);
+ MB_PTR_ADV(*s);
return retval;
}
@@ -1089,8 +1089,8 @@ win_lbr_chartabsize(
* needs a break here
*/
if (wp->w_p_lbr
- && vim_isbreak(c)
- && !vim_isbreak(s[1])
+ && VIM_ISBREAK(c)
+ && !VIM_ISBREAK(s[1])
&& wp->w_p_wrap
# ifdef FEAT_WINDOWS
&& wp->w_width != 0
@@ -1115,12 +1115,12 @@ win_lbr_chartabsize(
for (;;)
{
ps = s;
- mb_ptr_adv(s);
+ MB_PTR_ADV(s);
c = *s;
if (!(c != NUL
- && (vim_isbreak(c)
- || (!vim_isbreak(c)
- && (col2 == col || !vim_isbreak(*ps))))))
+ && (VIM_ISBREAK(c)
+ || (!VIM_ISBREAK(c)
+ && (col2 == col || !VIM_ISBREAK(*ps))))))
break;
col2 += win_chartabsize(wp, s, col2);
@@ -1369,7 +1369,7 @@ getvcol(
break;
vcol += incr;
- mb_ptr_adv(ptr);
+ MB_PTR_ADV(ptr);
}
}
else
@@ -1390,7 +1390,7 @@ getvcol(
break;
vcol += incr;
- mb_ptr_adv(ptr);
+ MB_PTR_ADV(ptr);
}
}
if (start != NULL)
diff --git a/src/edit.c b/src/edit.c
index 7082b9adcb..45eaf0ff23 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -857,7 +857,7 @@ edit(
if (str != NULL)
{
- for (p = str; *p != NUL; mb_ptr_adv(p))
+ for (p = str; *p != NUL; MB_PTR_ADV(p))
ins_compl_addleader(PTR2CHAR(p));
vim_free(str);
}
@@ -1492,7 +1492,7 @@ normalchar:
if (*str != NUL && stop_arrow() != FAIL)
{
/* Insert the new value of v:char literally. */
- for (p = str; *p != NUL; mb_ptr_adv(p))
+ for (p = str; *p != NUL; MB_PTR_ADV(p))
{
c = PTR2CHAR(p);
if (c == CAR || c == K_KENTER || c == NL)
@@ -2403,7 +2403,7 @@ ins_compl_add_infercase(
actual_len = 0;
while (*p != NUL)
{
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
++actual_len;
}
}
@@ -2419,7 +2419,7 @@ ins_compl_add_infercase(
actual_compl_length = 0;
while (*p != NUL)
{
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
++actual_compl_length;
}
}
@@ -2722,8 +2722,8 @@ ins_compl_longest_match(compl_T *match)
#ifdef FEAT_MBYTE
if (has_mbyte)
{
- mb_ptr_adv(p);
- mb_ptr_adv(s);
+ MB_PTR_ADV(p);
+ MB_PTR_ADV(s);
}
else
#endif
@@ -3474,7 +3474,7 @@ ins_compl_bs(void)
line = ml_get_curline();
p = line + curwin->w_cursor.col;
- mb_ptr_back(line, p);
+ MB_PTR_BACK(line, p);
/* Stop completion when the whole word was deleted. For Omni completion
* allow the word to be deleted, we won't match everything.
@@ -4023,7 +4023,7 @@ ins_compl_fixRedoBufForLeader(char_u *ptr_arg)
if (len > 0)
len -= (*mb_head_off)(p, p + len);
#endif
- for (p += len; *p != NUL; mb_ptr_adv(p))
+ for (p += len; *p != NUL; MB_PTR_ADV(p))
AppendCharToRedobuff(K_BS);
}
else
@@ -5336,9 +5336,9 @@ ins_complete(int c, int enable_pum)
{
char_u *p = line + startcol;
- mb_ptr_back(line, p);
+ MB_PTR_BACK(line, p);
while (p > line && vim_isfilec(PTR2CHAR(p)))
- mb_ptr_back(line, p);
+ MB_PTR_BACK(line, p);
if (p == line && vim_isfilec(PTR2CHAR(p)))
startcol = 0;
else
diff --git a/src/eval.c b/src/eval.c
index 61843bcfba..f52de721aa 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2551,7 +2551,7 @@ set_context_for_expression(
for (p = arg + STRLEN(arg); p >= arg; )
{
xp->xp_pattern = p;
- mb_ptr_back(arg, p);
+ MB_PTR_BACK(arg, p);
if (vim_iswhite(*p))
break;
}
@@ -4814,7 +4814,7 @@ 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))
+ for (p = *arg + 1; *p != NUL && *p != '"'; MB_PTR_ADV(p))
{
if (*p == '\\' && p[1] != NUL)
{
@@ -4952,7 +4952,7 @@ 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 != NUL; MB_PTR_ADV(p))
{
if (*p == '\'')
{
@@ -5910,7 +5910,7 @@ string_quote(char_u *str, int function)
if (str != NULL)
{
len += (unsigned)STRLEN(str);
- for (p = str; *p != NUL; mb_ptr_adv(p))
+ for (p = str; *p != NUL; MB_PTR_ADV(p))
if (*p == '\'')
++len;
}
@@ -6369,12 +6369,12 @@ find_name_end(
|| *p == '{'
|| ((flags & FNE_INCL_BR) && (*p == '[' || *p == '.'))
|| mb_nest != 0
- || br_nest != 0); mb_ptr_adv(p))
+ || 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 != NUL && *p != '\''; MB_PTR_ADV(p))
;
if (*p == NUL)
break;
@@ -6382,7 +6382,7 @@ find_name_end(
else if (*p == '"')
{
/* skip over "str\"ing" to avoid counting [ and ] inside it. */
- for (p = p + 1; *p != NUL && *p != '"'; mb_ptr_adv(p))
+ for (p = p + 1; *p != NUL && *p != '"'; MB_PTR_ADV(p))
if (*p == '\\' && p[1] != NUL)
++p;
if (*p == NUL)
@@ -9410,7 +9410,7 @@ shortpath_for_partial(
/* Count up the path separators from the RHS.. so we know which part
* of the path to return. */
sepcount = 0;
- for (p = *fnamep; p < *fnamep + *fnamelen; mb_ptr_adv(p))
+ for (p = *fnamep; p < *fnamep + *fnamelen; MB_PTR_ADV(p))
if (vim_ispathsep(*p))
++sepcount;
@@ -9528,7 +9528,7 @@ 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 != NUL; MB_PTR_ADV(p))
{
if (vim_ispathsep(*p)
&& p[1] == '.'
@@ -9658,7 +9658,7 @@ repeat:
*usedlen += 2;
s = get_past_head(*fnamep);
while (tail > s && after_pathsep(s, tail))
- mb_ptr_back(*fnamep, tail);
+ MB_PTR_BACK(*fnamep, tail);
*fnamelen = (int)(tail - *fnamep);
#ifdef VMS
if (*fnamelen > 0)
@@ -9677,7 +9677,7 @@ repeat:
else
{
while (tail > s && !after_pathsep(s, tail))
- mb_ptr_back(*fnamep, tail);
+ MB_PTR_BACK(*fnamep, tail);
}
}
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 386183d682..898ad41eb3 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -4863,7 +4863,7 @@ do_sub(exarg_T *eap)
}
if (cmd[0] == '\\' && cmd[1] != 0) /* skip escaped characters */
++cmd;
- mb_ptr_adv(cmd);
+ MB_PTR_ADV(cmd);
}
if (!eap->skip)
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index f8d35dc73d..2da38b7ca9 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -3526,7 +3526,7 @@ add_pack_plugin(char_u *fname, void *cookie)
{
/* directory is not yet in 'runtimepath', add it */
p4 = p3 = p2 = p1 = get_past_head(ffname);
- for (p = p1; *p; mb_ptr_adv(p))
+ for (p = p1; *p; MB_PTR_ADV(p))
if (vim_ispathsep_nocolon(*p))
{
p4 = p3; p3 = p2; p2 = p1; p1 = p;
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 0bf940f319..f107ee72e6 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -3696,7 +3696,7 @@ set_one_cmd_context(
return NULL; /* It's a comment */
}
}
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
}
@@ -3720,7 +3720,7 @@ set_one_cmd_context(
{
if (*p == '\\' && *(p + 1) != NUL)
++p; /* skip over escaped character */
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
}
@@ -3780,7 +3780,7 @@ set_one_cmd_context(
else
#endif
len = 1;
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
if (in_quote)
bow = p;
@@ -3788,7 +3788,7 @@ set_one_cmd_context(
xp->xp_pattern = p;
p -= len;
}
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
/*
@@ -4204,7 +4204,7 @@ set_one_cmd_context(
arg = p + 1;
else if (*p == '\\' && *(p + 1) != NUL)
++p; /* skip over escaped character */
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
xp->xp_pattern = arg;
}
@@ -5280,7 +5280,7 @@ separate_nextcmd(exarg_T *eap)
p = eap->arg;
#endif
- for ( ; *p; mb_ptr_adv(p))
+ for ( ; *p; MB_PTR_ADV(p))
{
if (*p == Ctrl_V)
{
@@ -5380,7 +5380,7 @@ skip_cmd_arg(
else
++p;
}
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
return p;
}
@@ -11861,7 +11861,7 @@ ses_put_fname(FILE *fd, char_u *name, unsigned *flagp)
if (*flagp & SSOP_SLASH)
{
/* change all backslashes to forward slashes */
- for (p = sname; *p != NUL; mb_ptr_adv(p))
+ for (p = sname; *p != NUL; MB_PTR_ADV(p))
if (*p == '\\')
*p = '/';
}
diff --git a/src/ex_getln.c b/src/ex_getln.c
index d3fda24c87..01286ac297 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4296,7 +4296,7 @@ sm_gettail(char_u *s)
t = p;
had_sep = FALSE;
}
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
return t;
}
@@ -5370,7 +5370,7 @@ ExpandRTDir(
if (e - 4 > s && STRNICMP(e - 4, ".vim", 4) == 0)
{
e -= 4;
- for (s = e; s > match; mb_ptr_back(match, s))
+ for (s = e; s > match; MB_PTR_BACK(match, s))
if (s < match || vim_ispathsep(*s))
break;
++s;
diff --git a/src/fileio.c b/src/fileio.c
index 48955e01ce..25706cc022 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6247,7 +6247,7 @@ buf_modname(
* Then truncate what is after the '/', '\' or ':' to 8 characters for
* MSDOS and 26 characters for AMIGA, a lot more for UNIX.
*/
- for (ptr = retval + fnamelen; ptr > retval; mb_ptr_back(retval, ptr))
+ for (ptr = retval + fnamelen; ptr > retval; MB_PTR_BACK(retval, ptr))
{
if (*ext == '.'
#ifdef USE_LONG_FNAME
diff --git a/src/fold.c b/src/fold.c
index db8da63ed1..9597ab8317 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -2064,7 +2064,7 @@ foldtext_cleanup(char_u *str)
}
else
{
- mb_ptr_adv(s);
+ MB_PTR_ADV(s);
}
}
}
@@ -3249,7 +3249,7 @@ foldlevelMarker(fline_T *flp)
--flp->lvl_next;
}
else
- mb_ptr_adv(s);
+ MB_PTR_ADV(s);
}
/* The level can't go negative, must be missing a start marker. */
diff --git a/src/gui.c b/src/gui.c
index 36d6975ed4..34f9f20459 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -4500,7 +4500,7 @@ scroll_line_len(linenr_T lnum)
for (;;)
{
w = chartabsize(p, col);
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
if (*p == NUL) /* don't count the last character */
break;
col += w;
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index c015d7ee66..d22a3ce5f8 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -1522,7 +1522,7 @@ split_button_string(char_u *button_string, int *n_buttons)
else if (*p == DLG_HOTKEY_CHAR)
*p++ = '_';
else
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
array[count] = NULL; /* currently not relied upon, but doesn't hurt */
}
diff --git a/src/macros.h b/src/macros.h
index 559a4bef02..97e7e83223 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -8,6 +8,9 @@
/*
* macros.h: macro definitions for often used code
+ *
+ * Macros should be ALL_CAPS. An exception is for where a function is
+ * replaced and an argument is not used more than once.
*/
/*
@@ -161,10 +164,10 @@
#endif
/*
- * vim_isbreak() is used very often if 'linebreak' is set, use a macro to make
- * it work fast.
+ * VIM_ISBREAK() is used very often if 'linebreak' is set, use a macro to make
+ * it work fast. Only works for single byte characters!
*/
-#define vim_isbreak(c) (breakat_flags[(char_u)(c)])
+#define VIM_ISBREAK(c) ((c) < 256 && breakat_flags[(char_u)(c)])
/*
* On VMS file names are different and require a translation.
@@ -190,9 +193,7 @@
# define mch_stat(n, p) vim_stat((n), (p))
# else
# ifdef STAT_IGNORES_SLASH
- /* On Solaris stat() accepts "file/" as if it was "file". Return -1 if
- * the name ends in "/" and it's not a directory. */
-# define mch_stat(n, p) (illegal_slash(n) ? -1 : stat((n), (p)))
+# define mch_stat(n, p) vim_stat((n), (p))
# else
# define mch_stat(n, p) stat((n), (p))
# endif
@@ -258,22 +259,22 @@
#endif
/*
- * mb_ptr_adv(): advance a pointer to the next character, taking care of
+ * MB_PTR_ADV(): advance a pointer to the next character, taking care of
* multi-byte characters if needed.
- * mb_ptr_back(): backup a pointer to the previous character, taking care of
+ * MB_PTR_BACK(): backup a pointer to the previous character, taking care of
* multi-byte characters if needed.
* MB_COPY_CHAR(f, t): copy one char from "f" to "t" and advance the pointers.
* PTR2CHAR(): get character from pointer.
*/
#ifdef FEAT_MBYTE
/* Get the length of the character p points to */
-# define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : 1)
+# define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : 1)
/* Advance multi-byte pointer, skip over composing chars. */
-# define mb_ptr_adv(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1
+# define MB_PTR_ADV(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1
/* Advance multi-byte pointer, do not skip over composing chars. */
-# define mb_cptr_adv(p) p += enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : 1
+# define MB_CPTR_ADV(p) p += enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : 1
/* Backup multi-byte pointer. Only use with "p" > "s" ! */
-# define mb_ptr_back(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1
+# define MB_PTR_BACK(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1
/* get length of multi-byte char, not including composing chars */
# define MB_CPTR2LEN(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p))
@@ -284,9 +285,9 @@
#else
# define MB_PTR2LEN(p) 1
# define MB_CPTR2LEN(p) 1
-# define mb_ptr_adv(p) ++p
-# define mb_cptr_adv(p) ++p
-# define mb_ptr_back(s, p) --p
+# define MB_PTR_ADV(p) ++p
+# define MB_CPTR_ADV(p) ++p
+# define MB_PTR_BACK(s, p) --p
# define MB_COPY_CHAR(f, t) *t++ = *f++
# define MB_CHARLEN(p) STRLEN(p)
# define MB_CHAR2LEN(c) 1
diff --git a/src/mark.c b/src/mark.c
index 0265160ab1..194125eb00 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -695,7 +695,7 @@ mark_line(pos_T *mp, int lead_len)
return NULL;
/* Truncate the line to fit it in the window */
len = 0;
- for (p = s; *p != NUL; mb_ptr_adv(p))
+ for (p = s; *p != NUL; MB_PTR_ADV(p))
{
len += ptr2cells(p);
if (len >= Columns - lead_len)
diff --git a/src/mbyte.c b/src/mbyte.c
index 11dc0fb350..d9bca6b074 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -4047,7 +4047,7 @@ mb_prevptr(
char_u *p)
{
if (p > line)
- mb_ptr_back(line, p);
+ MB_PTR_BACK(line, p);
return p;
}
@@ -5708,7 +5708,6 @@ static int xim_real_init(Window x11_window, Display *x11_display);
#ifdef USE_X11R6_XIM
-static void xim_instantiate_cb(Display *display, XPointer client_data, XPointer call_data);
static void xim_destroy_cb(XIM im, XPointer client_data, XPointer call_data);
static void
diff --git a/src/memline.c b/src/memline.c
index f9852e55bb..723bcd4bc5 100644
--- a/src/memline.c
+++ b/src/memline.c
@@ -2028,7 +2028,7 @@ make_percent_swname(char_u *dir, char_u *name)
if (s != NULL)
{
STRCPY(s, f);
- for (d = s; *d != NUL; mb_ptr_adv(d))
+ for (d = s; *d != NUL; MB_PTR_ADV(d))
if (vim_ispathsep(*d))
*d = '%';
d = concat_fnames(dir, s, TRUE);
@@ -4015,7 +4015,7 @@ get_file_in_dir(
#ifdef WIN3264
if (retval != NULL)
- for (t = gettail(retval); *t != NUL; mb_ptr_adv(t))
+ for (t = gettail(retval); *t != NUL; MB_PTR_ADV(t))
if (*t == ':')
*t = '%';
#endif
@@ -4154,7 +4154,7 @@ findswapname(
if (buf_fname == NULL)
buf_fname = buf->b_fname;
else
- for (t = gettail(buf_fname); *t != NUL; mb_ptr_adv(t))
+ for (t = gettail(buf_fname); *t != NUL; MB_PTR_ADV(t))
if (*t == ':')
*t = '%';
}
diff --git a/src/menu.c b/src/menu.c
index 05a229b455..b1b4ec7d41 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -152,7 +152,7 @@ ex_menu(
{
if (*arg == '\\')
STRMOVE(arg, arg + 1);
- mb_ptr_adv(arg);
+ MB_PTR_ADV(arg);
}
if (*arg != NUL)
{
@@ -661,7 +661,7 @@ add_menu_path(
STRCPY(tearpath, menu_path);
idx = (int)(next_name - path_name - 1);
- for (s = tearpath; *s && s < tearpath + idx; mb_ptr_adv(s))
+ for (s = tearpath; *s && s < tearpath + idx; MB_PTR_ADV(s))
{
if ((*s == '\\' || *s == Ctrl_V) && s[1])
{
@@ -1472,7 +1472,7 @@ menu_name_skip(char_u *name)
{
char_u *p;
- for (p = name; *p && *p != '.'; mb_ptr_adv(p))
+ for (p = name; *p && *p != '.'; MB_PTR_ADV(p))
{
if (*p == '\\' || *p == Ctrl_V)
{
@@ -2485,7 +2485,7 @@ menu_unescape_name(char_u *name)
{
char_u *p;
- for (p = name; *p && *p != '.'; mb_ptr_adv(p))
+ for (p = name; *p && *p != '.'; MB_PTR_ADV(p))
if (*p == '\\')
STRMOVE(p, p + 1);
}
diff --git a/src/message.c b/src/message.c
index a4d2cc8f3a..06f8cb9f15 100644
--- a/src/message.c
+++ b/src/message.c
@@ -3746,7 +3746,7 @@ msg_show_console_dialog(
}
/* advance to the next character */
- mb_ptr_adv(r);
+ MB_PTR_ADV(r);
}
if (copy)
diff --git a/src/misc1.c b/src/misc1.c
index e862219ab8..97c333af64 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -1140,7 +1140,7 @@ open_line(
while (old_size < repl_size && p > leader)
{
- mb_ptr_back(leader, p);
+ MB_PTR_BACK(leader, p);
old_size += ptr2cells(p);
}
l = lead_repl_len - (int)(endp - p);
@@ -2070,7 +2070,7 @@ plines_win_col(win_T *wp, linenr_T lnum, long column)
while (*s != NUL && --column >= 0)
{
col += win_lbr_chartabsize(wp, line, s, (colnr_T)col, NULL);
- mb_ptr_adv(s);
+ MB_PTR_ADV(s);
}
/*
@@ -4837,7 +4837,7 @@ gettail(char_u *fname)
{
if (vim_ispathsep_nocolon(*p2))
p1 = p2 + 1;
- mb_ptr_adv(p2);
+ MB_PTR_ADV(p2);
}
return p1;
}
@@ -4875,7 +4875,7 @@ gettail_dir(char_u *fname)
dir_end = next_dir_end;
look_for_sep = TRUE;
}
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
return dir_end;
}
@@ -4910,7 +4910,7 @@ gettail_sep(char_u *fname)
getnextcomp(char_u *fname)
{
while (*fname && !vim_ispathsep(*fname))
- mb_ptr_adv(fname);
+ MB_PTR_ADV(fname);
if (*fname)
++fname;
return fname;
@@ -10378,7 +10378,7 @@ find_previous_pathsep(char_u *path, char_u **psep)
{
if (vim_ispathsep(**psep))
return OK;
- mb_ptr_back(path, *psep);
+ MB_PTR_BACK(path, *psep);
}
return FAIL;
@@ -10533,7 +10533,7 @@ get_path_cutoff(char_u *fname, garray_T *gap)
/* skip to the file or directory name */
if (cutoff != NULL)
while (vim_ispathsep(*cutoff))
- mb_ptr_adv(cutoff);
+ MB_PTR_ADV(cutoff);
return cutoff;
}
@@ -10790,7 +10790,7 @@ static int has_env_var(char_u *p);
static int
has_env_var(char_u *p)
{
- for ( ; *p; mb_ptr_adv(p))
+ for ( ; *p; MB_PTR_ADV(p))
{
if (*p == '\\' && p[1] != NUL)
++p;
@@ -10816,7 +10816,7 @@ static int has_special_wildchar(char_u *p);
static int
has_special_wildchar(char_u *p)
{
- for ( ; *p; mb_ptr_adv(p))
+ for ( ; *p; MB_PTR_ADV(p))
{
/* Allow for escaping. */
if (*p == '\\' && p[1] != NUL)
@@ -11293,7 +11293,7 @@ get_isolated_shell_name(void)
/* Find the last path separator before the space. */
p1 = p_sh;
- for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
+ for (p2 = p_sh; p2 < p; MB_PTR_ADV(p2))
if (vim_ispathsep(*p2))
p1 = p2 + 1;
p = vim_strnsave(p1, (int)(p - p1));
diff --git a/src/misc2.c b/src/misc2.c
index cfdfc4c4ac..a6f3c1e21f 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -196,7 +196,7 @@ coladvance2(
/* Count a tab for what it's worth (if list mode not on) */
#ifdef FEAT_LINEBREAK
csize = win_lbr_chartabsize(curwin, line, ptr, col, &head);
- mb_ptr_adv(ptr);
+ MB_PTR_ADV(ptr);
#else
csize = lbr_chartabsize_adv(line, &ptr, col);
#endif
@@ -1418,7 +1418,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
/* First count the number of extra bytes required. */
length = (unsigned)STRLEN(string) + 3; /* two quotes and a trailing NUL */
- for (p = string; *p != NUL; mb_ptr_adv(p))
+ for (p = string; *p != NUL; MB_PTR_ADV(p))
{
# ifdef WIN32
if (!p_ssl)
@@ -1950,7 +1950,7 @@ vim_strrchr(char_u *string, int c)
{
if (*p == c)
retval = p;
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
}
return retval;
}
@@ -1971,7 +1971,7 @@ vim_strpbrk(char_u *s, char_u *charset)
{
if (vim_strchr(charset, *s) != NULL)
return s;
- mb_ptr_adv(s);
+ MB_PTR_ADV(s);
}
return NULL;
}
@@ -3364,7 +3364,7 @@ vim_chdirfile(char_u *fname)
* Used for systems where stat() ignores a trailing slash on a file name.
* The Vim code assumes a trailing slash is only ignored for a directory.
*/
- int
+ static int
illegal_slash(char *name)
{
if (name[0] == NUL)
@@ -3375,6 +3375,17 @@ illegal_slash(char *name)
return FALSE; /* trailing slash for a directory */
return TRUE;
}
+
+/*
+ * Special implementation of mch_stat() for Solaris.
+ */
+ int
+vim_stat(const char *name, stat_T *stp)
+{
+ /* On Solaris stat() accepts "file/" as if it was "file". Return -1 if
+ * the name ends in "/" and it's not a directory. */
+ return illegal_slash(n) ? -1 : stat(n, p);
+}
#endif
#if defined(CURSOR_SHAPE) || defined(PROTO)
diff --git a/src/ops.c b/src/ops.c
index 8b883aa305..23856c8457 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -486,7 +486,7 @@ shift_block(oparg_T *oap, int amount)
* the part of which is displayed at the block's beginning. Let's start
* searching from the next character. */
if (bd.startspaces)
- mb_ptr_adv(non_white);
+ MB_PTR_ADV(non_white);
/* The character's column is in "bd.start_vcol". */
non_white_col = bd.start_vcol;
@@ -526,7 +526,7 @@ shift_block(oparg_T *oap, int amount)
if (verbatim_copy_width + incr > destination_col)
break;
verbatim_copy_width += incr;
- mb_ptr_adv(verbatim_copy_end);
+ MB_PTR_ADV(verbatim_copy_end);
}
/* If "destination_col" is different from the width of the initial
@@ -3458,7 +3458,7 @@ do_put(
goto end;
p = ml_get_cursor();
if (dir == FORWARD && *p != NUL)
- mb_ptr_adv(p);
+ MB_PTR_ADV(p);
ptr = vim_strsave(p);
if (ptr == NULL)
goto end;
@@ -3468,7 +3468,7 @@ do_put(
oldp = ml_get_curline();