Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: extract initialization_end_brace_l...



details:   https://anonhg.NetBSD.org/src/rev/5179b6d48339
branches:  trunk
changeset: 960770:5179b6d48339
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Mar 28 16:19:21 2021 +0000

description:
lint: extract initialization_end_brace_level

No functional change.

diffstat:

 usr.bin/xlint/lint1/init.c |  19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diffs (52 lines):

diff -r 25d8c2817610 -r 5179b6d48339 usr.bin/xlint/lint1/init.c
--- a/usr.bin/xlint/lint1/init.c        Sun Mar 28 15:39:25 2021 +0000
+++ b/usr.bin/xlint/lint1/init.c        Sun Mar 28 16:19:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.164 2021/03/28 15:39:25 rillig Exp $        */
+/*     $NetBSD: init.c,v 1.165 2021/03/28 16:19:21 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: init.c,v 1.164 2021/03/28 15:39:25 rillig Exp $");
+__RCSID("$NetBSD: init.c,v 1.165 2021/03/28 16:19:21 rillig Exp $");
 #endif
 
 #include <stdlib.h>
@@ -845,12 +845,20 @@
        return false;
 }
 
+static void
+initialization_end_brace_level(struct initialization *in)
+{
+       struct brace_level *level = in->brace_level;
+       in->brace_level = level->bl_enclosing;
+       brace_level_free(level);
+}
+
 /* TODO: document me */
 /* TODO: think of a better name than 'push' */
 static void
 initialization_push(struct initialization *in)
 {
-       struct brace_level *level, *enclosing;
+       struct brace_level *level;
 
        debug_enter();
 
@@ -897,10 +905,7 @@
                if (in->designation.head != NULL) {
                        debug_step("pop scalar");
                pop:
-                       /* TODO: extract this into end_initializer_level */
-                       enclosing = in->brace_level->bl_enclosing;
-                       brace_level_free(level);
-                       in->brace_level = enclosing;
+                       initialization_end_brace_level(in);
                        goto again;
                }
                /* The initialization stack now expects a single scalar. */



Home | Main Index | Thread Index | Old Index