From 36e210718cc0242d3d1a043bd32b4618db592024 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Tue, 29 Aug 2023 09:48:10 -0400 Subject: [PATCH] [ruby/yarp] simplify `context_pop` https://github.com/ruby/yarp/commit/fe85b595b6 --- yarp/yarp.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/yarp/yarp.c b/yarp/yarp.c index ad433efc4b..8cd2c2007b 100644 --- a/yarp/yarp.c +++ b/yarp/yarp.c @@ -4902,14 +4902,9 @@ context_push(yp_parser_t *parser, yp_context_t context) { static void context_pop(yp_parser_t *parser) { - if (parser->current_context->prev == NULL) { - free(parser->current_context); - parser->current_context = NULL; - } else { - yp_context_node_t *prev = parser->current_context->prev; - free(parser->current_context); - parser->current_context = prev; - } + yp_context_node_t *prev = parser->current_context->prev; + free(parser->current_context); + parser->current_context = prev; } static bool