summary refs log tree commit diff
path: root/bin/cash
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-01-19 00:41:27 -0500
committerJune McEnroe <june@causal.agency>2019-01-19 00:41:27 -0500
commit774d8fcf11d88f5191938dfef3d8d0764f7ecbe1 (patch)
tree7ce0257f4d8b1ad3da76485cf92db3d501e52d5e /bin/cash
parentTake event number for save incr (diff)
downloadsrc-774d8fcf11d88f5191938dfef3d8d0764f7ecbe1.tar.gz
src-774d8fcf11d88f5191938dfef3d8d0764f7ecbe1.zip
Fix ordering issue with va_arg calls
Diffstat (limited to '')
-rw-r--r--bin/cash/libedit/history.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/cash/libedit/history.c b/bin/cash/libedit/history.c
index a8967088..005fe2a0 100644
--- a/bin/cash/libedit/history.c
+++ b/bin/cash/libedit/history.c
@@ -1162,10 +1162,14 @@ FUNW(history)(TYPE(History) *h, TYPE(HistEvent) *ev, int fun, ...)
 		break;
 
 	case H_SAVE_INCR:
-		retval = history_save_incr(h, va_arg(va, const char *), va_arg(va, int));
+	{
+		const char *fname = va_arg(va, const char *);
+		int num = va_arg(va, int);
+		retval = history_save_incr(h, fname, num);
 		if (retval == -1)
 			he_seterrev(ev, _HE_HIST_WRITE);
 		break;
+	}
 
 	case H_SAVE_FP:
 		retval = history_save_fp(h, va_arg(va, FILE *));
@@ -1174,10 +1178,14 @@ FUNW(history)(TYPE(History) *h, TYPE(HistEvent) *ev, int fun, ...)
 		break;
 
 	case H_SAVE_FP_INCR:
-		retval = history_save_fp_incr(h, va_arg(va, FILE *), va_arg(va, int));
+	{
+		FILE *fp = va_arg(va, FILE *);
+		int num = va_arg(va, int);
+		retval = history_save_fp_incr(h, fp, num);
 		if (retval == -1)
 			he_seterrev(ev, _HE_HIST_WRITE);
 		break;
+	}
 
 	case H_PREV_EVENT:
 		retval = history_prev_event(h, ev, va_arg(va, int));