From: Brian Demsky <bdemsky@uci.edu>
Date: Fri, 19 Jan 2018 23:52:10 +0000 (-0800)
Subject: Improve libc support
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f3515cbdd584cff4c03a6896ab1eb3d068f1040c;p=satune.git

Improve libc support
---

diff --git a/src/common.h b/src/common.h
index 7343c83..256aaf3 100644
--- a/src/common.h
+++ b/src/common.h
@@ -24,7 +24,7 @@ extern int model_out;
 extern int model_err;
 extern int switch_alloc;
 
-#define model_dprintf(fd, fmt, ...) do { switch_alloc = 1; dprintf(fd, fmt, ## __VA_ARGS__); switch_alloc = 0; } while (0)
+#define model_dprintf(fd, fmt, ...) do { int oldsw = switch_alloc; switch_alloc = 1; dprintf(fd, fmt, ## __VA_ARGS__); switch_alloc = oldsw; } while (0)
 
 #define model_print(fmt, ...) do { model_dprintf(model_out, fmt, ## __VA_ARGS__); } while (0)
 #define model_print_err(fmt, ...) do { model_dprintf(model_err, fmt, ## __VA_ARGS__); } while (0)