Source-Changes-HG archive

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

[src/trunk]: src/lib/libedit The order in which the arguments to a function a...



details:   https://anonhg.NetBSD.org/src/rev/a2f4b1d9f283
branches:  trunk
changeset: 358350:a2f4b1d9f283
user:      uwe <uwe%NetBSD.org@localhost>
date:      Sat Dec 23 18:25:03 2017 +0000

description:
The order in which the arguments to a function are evaluated is
undefined, so don't use va_arg() twice.

PR lib/52849

diffstat:

 lib/libedit/history.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r a4305a4655bc -r a2f4b1d9f283 lib/libedit/history.c
--- a/lib/libedit/history.c     Sat Dec 23 12:50:55 2017 +0000
+++ b/lib/libedit/history.c     Sat Dec 23 18:25:03 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: history.c,v 1.58 2017/09/01 10:19:10 christos Exp $    */
+/*     $NetBSD: history.c,v 1.59 2017/12/23 18:25:03 uwe Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)history.c  8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: history.c,v 1.58 2017/09/01 10:19:10 christos Exp $");
+__RCSID("$NetBSD: history.c,v 1.59 2017/12/23 18:25:03 uwe Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -1082,11 +1082,13 @@
                break;
 
        case H_NSAVE_FP:
-               retval = history_save_fp(h, va_arg(va, size_t),
-                   va_arg(va, FILE *));
+       {
+               size_t sz = va_arg(va, size_t);
+               retval = history_save_fp(h, sz, va_arg(va, FILE *));
                if (retval == -1)
                    he_seterrev(ev, _HE_HIST_WRITE);
                break;
+       }
 
        case H_PREV_EVENT:
                retval = history_prev_event(h, ev, va_arg(va, int));



Home | Main Index | Thread Index | Old Index