From 7998dcdedc7f1d3cfaabfc3f68ca7635f0e5e1d1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 14 Nov 2023 22:07:15 +0900 Subject: [PATCH] Remove invariant condition The `while` loop condition dereferences `cfp` and no `break` there, `cfp` cannot be NULL just after the loop. --- vm.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/vm.c b/vm.c index 789e0956be..80a6552cea 100644 --- a/vm.c +++ b/vm.c @@ -1750,12 +1750,7 @@ rb_vm_svar_lep(const rb_execution_context_t *ec, const rb_control_frame_t *cfp) } } - if (cfp) { - return (VALUE *)VM_CF_LEP(cfp); - } - else { - return NULL; - } + return (VALUE *)VM_CF_LEP(cfp); } static VALUE