Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sysinst scripting_vprintf: to simplify things for g...



details:   https://anonhg.NetBSD.org/src/rev/255611e109a0
branches:  trunk
changeset: 461969:255611e109a0
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jul 21 12:23:18 2019 +0000

description:
scripting_vprintf: to simplify things for gcc (and avoid "may be used
uninitialized" warnings) just always copy the va_list and use one
copy for the first pass, the other for the second.

diffstat:

 usr.sbin/sysinst/util.c |  11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diffs (29 lines):

diff -r cd6191660834 -r 255611e109a0 usr.sbin/sysinst/util.c
--- a/usr.sbin/sysinst/util.c   Sun Jul 21 12:15:13 2019 +0000
+++ b/usr.sbin/sysinst/util.c   Sun Jul 21 12:23:18 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: util.c,v 1.27 2019/07/21 11:35:36 martin Exp $ */
+/*     $NetBSD: util.c,v 1.28 2019/07/21 12:23:18 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1469,16 +1469,13 @@
 void
 scripting_vfprintf(FILE *f, const char *fmt, va_list ap)
 {
-       va_list saved;
+       va_list ap2;
 
-       if (f && script)
-               va_copy(saved, ap);
+       va_copy(ap2, ap);
        if (f)
                (void)vfprintf(f, fmt, ap);
-       if (f && script)
-               va_copy(ap, saved);
        if (script)
-               (void)vfprintf(script, fmt, ap);
+               (void)vfprintf(script, fmt, ap2);
 }
 
 void



Home | Main Index | Thread Index | Old Index