eval: Fix useless NULL check

partial_name() as it is written now really cannot return NULL
This commit is contained in:
ZyX
2017-04-16 20:07:54 +03:00
parent 7c9e3d6cad
commit 31190879cc

View File

@@ -8977,13 +8977,10 @@ static void f_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (strcmp(what, "func") == 0 || strcmp(what, "name") == 0) { if (strcmp(what, "func") == 0 || strcmp(what, "name") == 0) {
rettv->v_type = (*what == 'f' ? VAR_FUNC : VAR_STRING); rettv->v_type = (*what == 'f' ? VAR_FUNC : VAR_STRING);
const char *const n = (const char *)partial_name(pt); const char *const n = (const char *)partial_name(pt);
if (n == NULL) { assert(n != NULL);
rettv->vval.v_string = NULL; rettv->vval.v_string = (char_u *)xstrdup(n);
} else { if (rettv->v_type == VAR_FUNC) {
rettv->vval.v_string = (char_u *)xstrdup(n); func_ref(rettv->vval.v_string);
if (rettv->v_type == VAR_FUNC) {
func_ref(rettv->vval.v_string);
}
} }
} else if (strcmp(what, "dict") == 0) { } else if (strcmp(what, "dict") == 0) {
rettv->v_type = VAR_DICT; rettv->v_type = VAR_DICT;