summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-19 19:30:53 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-19 19:30:53 +0200
commit1e0b7b11db61bd906266d3174fee0bbaf20a101f (patch)
tree626905059e2bb40344abcff8b7717e428ca2a895
parentec9b017b879cb744393aadd3d105ee5da1332437 (diff)
patch 8.2.1014: using "name" for a string result is confusingv8.2.1014
Problem: Using "name" for a string result is confusing. Solution: Rename to "end".
-rw-r--r--src/typval.c47
-rw-r--r--src/version.c2
2 files changed, 25 insertions, 24 deletions
diff --git a/src/typval.c b/src/typval.c
index 23530a5dc5..ebc51c6af3 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -1182,7 +1182,7 @@ get_number_tv(
get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
{
char_u *p;
- char_u *name;
+ char_u *end;
int extra = 0;
int len;
@@ -1216,12 +1216,12 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
// Copy the string into allocated memory, handling backslashed
// characters.
+ rettv->v_type = VAR_STRING;
len = (int)(p - *arg + extra);
- name = alloc(len);
- if (name == NULL)
+ rettv->vval.v_string = alloc(len);
+ if (rettv->vval.v_string == NULL)
return FAIL;
- rettv->v_type = VAR_STRING;
- rettv->vval.v_string = name;
+ end = rettv->vval.v_string;
for (p = *arg + 1; *p != NUL && *p != '"'; )
{
@@ -1229,12 +1229,12 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
{
switch (*++p)
{
- case 'b': *name++ = BS; ++p; break;
- case 'e': *name++ = ESC; ++p; break;
- case 'f': *name++ = FF; ++p; break;
- case 'n': *name++ = NL; ++p; break;
- case 'r': *name++ = CAR; ++p; break;
- case 't': *name++ = TAB; ++p; break;
+ case 'b': *end++ = BS; ++p; break;
+ case 'e': *end++ = ESC; ++p; break;
+ case 'f': *end++ = FF; ++p; break;
+ case 'n': *end++ = NL; ++p; break;
+ case 'r': *end++ = CAR; ++p; break;
+ case 't': *end++ = TAB; ++p; break;
case 'X': // hex: "\x1", "\x12"
case 'x':
@@ -1261,9 +1261,9 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
// For "\u" store the number according to
// 'encoding'.
if (c != 'X')
- name += (*mb_char2bytes)(nr, name);
+ end += (*mb_char2bytes)(nr, end);
else
- *name++ = nr;
+ *end++ = nr;
}
break;
@@ -1275,14 +1275,14 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
case '4':
case '5':
case '6':
- case '7': *name = *p++ - '0';
+ case '7': *end = *p++ - '0';
if (*p >= '0' && *p <= '7')
{
- *name = (*name << 3) + *p++ - '0';
+ *end = (*end << 3) + *p++ - '0';
if (*p >= '0' && *p <= '7')
- *name = (*name << 3) + *p++ - '0';
+ *end = (*end << 3) + *p++ - '0';
}
- ++name;
+ ++end;
break;
// Special key, e.g.: "\<C-W>"
@@ -1292,26 +1292,25 @@ get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
if (p[1] != '*')
flags |= FSK_SIMPLIFY;
- extra = trans_special(&p, name, flags, NULL);
+ extra = trans_special(&p, end, flags, NULL);
if (extra != 0)
{
- name += extra;
- if (name >= rettv->vval.v_string + len)
+ end += extra;
+ if (end >= rettv->vval.v_string + len)
iemsg("get_string_tv() used more space than allocated");
break;
}
}
// FALLTHROUGH
- default: MB_COPY_CHAR(p, name);
+ default: MB_COPY_CHAR(p, end);
break;
}
}
else
- MB_COPY_CHAR(p, name);
-
+ MB_COPY_CHAR(p, end);
}
- *name = NUL;
+ *end = NUL;
if (*p != NUL) // just in case
++p;
*arg = p;
diff --git a/src/version.c b/src/version.c
index 4cc8261325..3ccf1dd094 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1014,
+/**/
1013,
/**/
1012,