aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/regexp.c
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-08-19 12:26:08 -0600
committerJosh Rahm <rahm@google.com>2022-08-19 13:06:41 -0600
commita7237662f96933efe29eed8212464571e3778cd0 (patch)
tree27930202726b4251437c8cfa53069f65b4db90dc /src/nvim/regexp.c
parent02292344929069ea63c0bb872cc22d552d86b67f (diff)
parentb2f979b30beac67906b2dd717fcb6a34f46f5e54 (diff)
downloadrneovim-a7237662f96933efe29eed8212464571e3778cd0.tar.gz
rneovim-a7237662f96933efe29eed8212464571e3778cd0.tar.bz2
rneovim-a7237662f96933efe29eed8212464571e3778cd0.zip
Merge branch 'master' of https://github.com/neovim/neovim into rahmtmp
Diffstat (limited to 'src/nvim/regexp.c')
-rw-r--r--src/nvim/regexp.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index fbbf904f8b..b7ec4bf94e 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -20,7 +20,6 @@
#include "nvim/charset.h"
#include "nvim/eval.h"
#include "nvim/eval/userfunc.h"
-#include "nvim/ex_cmds2.h"
#include "nvim/garray.h"
#include "nvim/mark.h"
#include "nvim/memline.h"
@@ -28,6 +27,7 @@
#include "nvim/message.h"
#include "nvim/os/input.h"
#include "nvim/plines.h"
+#include "nvim/profile.h"
#include "nvim/regexp.h"
#include "nvim/strings.h"
#include "nvim/vim.h"
@@ -481,16 +481,14 @@ static char_u *skip_anyof(char *p)
return (char_u *)p;
}
-/*
- * Skip past regular expression.
- * Stop at end of "startp" or where "dirc" is found ('/', '?', etc).
- * Take care of characters with a backslash in front of it.
- * Skip strings inside [ and ].
- * When "newp" is not NULL and "dirc" is '?', make an allocated copy of the
- * expression and change "\?" to "?". If "*newp" is not NULL the expression
- * is changed in-place.
- */
-char_u *skip_regexp(char_u *startp, int dirc, int magic, char_u **newp)
+/// Skip past regular expression.
+/// Stop at end of "startp" or where "dirc" is found ('/', '?', etc).
+/// Take care of characters with a backslash in front of it.
+/// Skip strings inside [ and ].
+/// When "newp" is not NULL and "dirc" is '?', make an allocated copy of the
+/// expression and change "\?" to "?". If "*newp" is not NULL the expression
+/// is changed in-place.
+char_u *skip_regexp(char_u *startp, int dirc, int magic, char **newp)
{
int mymagic;
char_u *p = startp;
@@ -516,8 +514,8 @@ char_u *skip_regexp(char_u *startp, int dirc, int magic, char_u **newp)
if (dirc == '?' && newp != NULL && p[1] == '?') {
// change "\?" to "?", make a copy first.
if (*newp == NULL) {
- *newp = vim_strsave(startp);
- p = *newp + (p - startp);
+ *newp = (char *)vim_strsave(startp);
+ p = (char_u *)(*newp) + (p - startp);
}
STRMOVE(p, p + 1);
} else {
@@ -823,7 +821,7 @@ static int64_t gethexchrs(int maxinputlen)
}
nr <<= 4;
nr |= hex2nr(c);
- ++regparse;
+ regparse++;
}
if (i == 0) {
@@ -880,7 +878,7 @@ static int64_t getoctchrs(void)
}
nr <<= 3;
nr |= hex2nr(c);
- ++regparse;
+ regparse++;
}
if (i == 0) {
@@ -2097,8 +2095,8 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest, int des
dst++;
}
- ++s;
- --len;
+ s++;
+ len--;
}
}
}