Created
May 1, 2017 22:36
-
-
Save h-east/a22b305ddfdd1b1b6862912da5142959 to your computer and use it in GitHub Desktop.
Patch for vim-jp #1049
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/eval.c b/src/eval.c | |
index 401171c..ba85a28 100644 | |
--- a/src/eval.c | |
+++ b/src/eval.c | |
@@ -2092,7 +2092,7 @@ get_lval( | |
lp->ll_n1 = 0; | |
else | |
/* is number or string */ | |
- lp->ll_n1 = (long)get_tv_number(&var1); | |
+ lp->ll_n1 = (varnumber_T)get_tv_number(&var1); | |
clear_tv(&var1); | |
lp->ll_dict = NULL; | |
@@ -2122,7 +2122,7 @@ get_lval( | |
*/ | |
if (lp->ll_range && !lp->ll_empty2) | |
{ | |
- lp->ll_n2 = (long)get_tv_number(&var2); | |
+ lp->ll_n2 = (varnumber_T)get_tv_number(&var2); | |
/* is number or string */ | |
clear_tv(&var2); | |
if (lp->ll_n2 < 0) | |
@@ -2216,7 +2216,7 @@ set_var_lval( | |
else if (lp->ll_range) | |
{ | |
listitem_T *ll_li = lp->ll_li; | |
- int ll_n1 = lp->ll_n1; | |
+ varnumber_T ll_n1 = lp->ll_n1; | |
/* | |
* Check whether any of the list items is locked | |
@@ -2763,7 +2763,7 @@ do_unlet_var( | |
{ | |
listitem_T *li; | |
listitem_T *ll_li = lp->ll_li; | |
- int ll_n1 = lp->ll_n1; | |
+ varnumber_T ll_n1 = lp->ll_n1; | |
while (ll_li != NULL && (lp->ll_empty2 || lp->ll_n2 >= ll_n1)) | |
{ | |
@@ -4448,8 +4448,8 @@ eval_index( | |
{ | |
int empty1 = FALSE, empty2 = FALSE; | |
typval_T var1, var2; | |
- long n1, n2 = 0; | |
- long len = -1; | |
+ varnumber_T n1, n2 = 0; | |
+ varnumber_T len = -1; | |
int range = FALSE; | |
char_u *s; | |
char_u *key = NULL; | |
@@ -4589,7 +4589,7 @@ eval_index( | |
case VAR_NUMBER: | |
case VAR_STRING: | |
s = get_tv_string(rettv); | |
- len = (long)STRLEN(s); | |
+ len = (varnumber_T)STRLEN(s); | |
if (range) | |
{ | |
/* The resulting variable is a substring. If the indexes | |
diff --git a/src/list.c b/src/list.c | |
index 2fccbae..5cf34e9 100644 | |
--- a/src/list.c | |
+++ b/src/list.c | |
@@ -243,7 +243,7 @@ listitem_remove(list_T *l, listitem_T *item) | |
/* | |
* Get the number of items in a list. | |
*/ | |
- long | |
+ varnumber_T | |
list_len(list_T *l) | |
{ | |
if (l == NULL) | |
@@ -284,10 +284,10 @@ list_equal( | |
* Returns NULL when "n" is out of range. | |
*/ | |
listitem_T * | |
-list_find(list_T *l, long n) | |
+list_find(list_T *l, varnumber_T n) | |
{ | |
listitem_T *item; | |
- long idx; | |
+ varnumber_T idx; | |
if (l == NULL) | |
return NULL; | |
@@ -361,10 +361,10 @@ list_find(list_T *l, long n) | |
/* | |
* Get list item "l[idx]" as a number. | |
*/ | |
- long | |
+ varnumber_T | |
list_find_nr( | |
list_T *l, | |
- long idx, | |
+ varnumber_T idx, | |
int *errorp) /* set to TRUE when something wrong */ | |
{ | |
listitem_T *li; | |
@@ -376,14 +376,14 @@ list_find_nr( | |
*errorp = TRUE; | |
return -1L; | |
} | |
- return (long)get_tv_number_chk(&li->li_tv, errorp); | |
+ return get_tv_number_chk(&li->li_tv, errorp); | |
} | |
/* | |
* Get list item "l[idx - 1]" as a string. Returns NULL for failure. | |
*/ | |
char_u * | |
-list_find_str(list_T *l, long idx) | |
+list_find_str(list_T *l, varnumber_T idx) | |
{ | |
listitem_T *li; | |
@@ -400,10 +400,10 @@ list_find_str(list_T *l, long idx) | |
* Locate "item" list "l" and return its index. | |
* Returns -1 when "item" is not in the list. | |
*/ | |
- long | |
+ varnumber_T | |
list_idx_of_item(list_T *l, listitem_T *item) | |
{ | |
- long idx = 0; | |
+ varnumber_T idx = 0; | |
listitem_T *li; | |
if (l == NULL) | |
diff --git a/src/proto/list.pro b/src/proto/list.pro | |
index fe54bab..45bf0e6 100644 | |
--- a/src/proto/list.pro | |
+++ b/src/proto/list.pro | |
@@ -12,12 +12,12 @@ void list_free(list_T *l); | |
listitem_T *listitem_alloc(void); | |
void listitem_free(listitem_T *item); | |
void listitem_remove(list_T *l, listitem_T *item); | |
-long list_len(list_T *l); | |
+varnumber_T list_len(list_T *l); | |
int list_equal(list_T *l1, list_T *l2, int ic, int recursive); | |
-listitem_T *list_find(list_T *l, long n); | |
-long list_find_nr(list_T *l, long idx, int *errorp); | |
-char_u *list_find_str(list_T *l, long idx); | |
-long list_idx_of_item(list_T *l, listitem_T *item); | |
+listitem_T *list_find(list_T *l, varnumber_T n); | |
+varnumber_T list_find_nr(list_T *l, varnumber_T idx, int *errorp); | |
+char_u *list_find_str(list_T *l, varnumber_T idx); | |
+varnumber_T list_idx_of_item(list_T *l, listitem_T *item); | |
void list_append(list_T *l, listitem_T *item); | |
int list_append_tv(list_T *l, typval_T *tv); | |
int list_append_dict(list_T *list, dict_T *dict); | |
diff --git a/src/structs.h b/src/structs.h | |
index 0175017..2bc78f3 100644 | |
--- a/src/structs.h | |
+++ b/src/structs.h | |
@@ -3334,8 +3334,8 @@ typedef struct lval_S | |
listitem_T *ll_li; /* The list item or NULL. */ | |
list_T *ll_list; /* The list or NULL. */ | |
int ll_range; /* TRUE when a [i:j] range was used */ | |
- long ll_n1; /* First index for list */ | |
- long ll_n2; /* Second index for list range */ | |
+ varnumber_T ll_n1; /* First index for list */ | |
+ varnumber_T ll_n2; /* Second index for list range */ | |
int ll_empty2; /* Second index is empty: [i:] */ | |
dict_T *ll_dict; /* The Dictionary or NULL */ | |
dictitem_T *ll_di; /* The dictitem or NULL */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment