summary refs log tree commit diff
path: root/bin/cash/libedit
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
commit010a412a23b839d7401cda3516dafe9dcf0d7884 (patch)
treec1942d47503106f4bc9c1e9e192d5e43a08dd913 /bin/cash/libedit
parentTake event number for save incr (diff)
downloadsrc-010a412a23b839d7401cda3516dafe9dcf0d7884.tar.gz
src-010a412a23b839d7401cda3516dafe9dcf0d7884.zip
Fix ordering issue with va_arg calls
Diffstat (limited to 'bin/cash/libedit')
-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));