Skip to content

Commit 81e7a9c

Browse files
committed
patch 7.4.1270
Problem: Warnings for missing values in switch. Solution: Change switch to if-else or add values.
1 parent 4f8b8fa commit 81e7a9c

4 files changed

Lines changed: 18 additions & 5 deletions

File tree

src/if_py_both.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5831,11 +5831,10 @@ convert_dl(PyObject *obj, typval_T *tv,
58315831
}
58325832
/* As we are not using copy_tv which increments reference count we must
58335833
* do it ourself. */
5834-
switch(tv->v_type)
5835-
{
5836-
case VAR_DICT: ++tv->vval.v_dict->dv_refcount; break;
5837-
case VAR_LIST: ++tv->vval.v_list->lv_refcount; break;
5838-
}
5834+
if (tv->v_type == VAR_DICT)
5835+
++tv->vval.v_dict->dv_refcount;
5836+
else if (tv->v_type == VAR_LIST)
5837+
++tv->vval.v_list->lv_refcount;
58395838
}
58405839
else
58415840
{

src/if_python.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,6 +1556,12 @@ do_pyeval (char_u *str, typval_T *rettv)
15561556
rettv->v_type = VAR_NUMBER;
15571557
rettv->vval.v_number = 0;
15581558
break;
1559+
case VAR_NUMBER:
1560+
case VAR_STRING:
1561+
case VAR_FLOAT:
1562+
case VAR_JOB:
1563+
case VAR_SPECIAL:
1564+
break;
15591565
}
15601566
}
15611567

src/if_python3.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,12 @@ do_py3eval (char_u *str, typval_T *rettv)
16491649
rettv->v_type = VAR_NUMBER;
16501650
rettv->vval.v_number = 0;
16511651
break;
1652+
case VAR_NUMBER:
1653+
case VAR_STRING:
1654+
case VAR_FLOAT:
1655+
case VAR_JOB:
1656+
case VAR_SPECIAL:
1657+
break;
16521658
}
16531659
}
16541660

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
1270,
745747
/**/
746748
1269,
747749
/**/

0 commit comments

Comments
 (0)