summaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2021-07-10 21:29:18 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-10 21:29:18 +0200
commita2438132a675be4dde3acbdf03ba1fdb2f09427c (patch)
tree973f677bea21a7f41bbb9d49ad0038550e6e665b /src/eval.c
parent31e21766d6fb0a386e15ccc8c2192f6a3a210f53 (diff)
patch 8.2.3139: functions for string manipulation are spread outv8.2.3139
Problem: Functions for string manipulation are spread out. Solution: Move string related functions to a new source file. (Yegappan Lakshmanan, closes #8470)
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c49
1 files changed, 3 insertions, 46 deletions
diff --git a/src/eval.c b/src/eval.c
index e0f0816030..4d94d67ee6 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -57,6 +57,7 @@ static int eval7_leader(typval_T *rettv, int numeric_only, char_u *start_leader,
static int free_unref_items(int copyID);
static char_u *make_expanded_name(char_u *in_start, char_u *expr_start, char_u *expr_end, char_u *in_end);
+static char_u *eval_next_line(evalarg_T *evalarg);
/*
* Return "n1" divided by "n2", taking care of dividing by zero.
@@ -2113,7 +2114,7 @@ getline_peek_skip_comments(evalarg_T *evalarg)
* FALSE.
* "arg" must point somewhere inside a line, not at the start.
*/
- char_u *
+ static char_u *
eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext)
{
char_u *p = skipwhite(arg);
@@ -2144,7 +2145,7 @@ eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext)
* To be called after eval_next_non_blank() sets "getnext" to TRUE.
* Only called for Vim9 script.
*/
- char_u *
+ static char_u *
eval_next_line(evalarg_T *evalarg)
{
garray_T *gap = &evalarg->eval_ga;
@@ -5172,50 +5173,6 @@ echo_string(
}
/*
- * Return string "str" in ' quotes, doubling ' characters.
- * If "str" is NULL an empty string is assumed.
- * If "function" is TRUE make it function('string').
- */
- char_u *
-string_quote(char_u *str, int function)
-{
- unsigned len;
- char_u *p, *r, *s;
-
- len = (function ? 13 : 3);
- if (str != NULL)
- {
- len += (unsigned)STRLEN(str);
- for (p = str; *p != NUL; MB_PTR_ADV(p))
- if (*p == '\'')
- ++len;
- }
- s = r = alloc(len);
- if (r != NULL)
- {
- if (function)
- {
- STRCPY(r, "function('");
- r += 10;
- }
- else
- *r++ = '\'';
- if (str != NULL)
- for (p = str; *p != NUL; )
- {
- if (*p == '\'')
- *r++ = '\'';
- MB_COPY_CHAR(p, r);
- }
- *r++ = '\'';
- if (function)
- *r++ = ')';
- *r++ = NUL;
- }
- return s;
-}
-
-/*
* Convert the specified byte index of line 'lnum' in buffer 'buf' to a
* character index. Works only for loaded buffers. Returns -1 on failure.
* The index of the first byte and the first character is zero.