diff options
author | Nathan Froyd <froydnj@gmail.com> | 2023-08-29 09:48:10 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-08-29 15:36:21 +0000 |
commit | 36e210718cc0242d3d1a043bd32b4618db592024 (patch) | |
tree | ff7408d49d367f56ba8a38c93f9e403249f616f1 | |
parent | 062eec75582dc0c813c945c2ce900e6ce0487610 (diff) | |
download | ruby-36e210718cc0242d3d1a043bd32b4618db592024.tar.gz |
[ruby/yarp] simplify `context_pop`
https://github.com/ruby/yarp/commit/fe85b595b6
-rw-r--r-- | yarp/yarp.c | 11 |
1 files 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 |