chiark
/
gitweb
/
~ianmdlvl
/
matchsticks-search.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f133b2f
)
introduce progress_eol and make stderr line buffered
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 8 Mar 2014 17:47:06 +0000
(17:47 +0000)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sat, 8 Mar 2014 17:47:06 +0000
(17:47 +0000)
main.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index 0cc8d9b8317012885e665c15767d51b9874a8976..a81687172b545275b1c5b10d1c27c8c14bc78873 100644
(file)
--- a/
main.c
+++ b/
main.c
@@
-91,6
+91,11
@@
static unsigned printcounter;
static int ncpus = 1;
static int ncpus = 1;
+static void progress_eol(void) {
+ fprintf(stderr," \r");
+ fflush(stderr);
+}
+
static AdjWord *xalloc_adjmatrix(void) {
return xmalloc(sizeof(*adjmatrix)*n);
}
static AdjWord *xalloc_adjmatrix(void) {
return xmalloc(sizeof(*adjmatrix)*n);
}
@@
-99,6
+104,7
@@
static void prep(void) {
adjall = ~((~(AdjWord)0) << m);
adjmatrix = xalloc_adjmatrix();
glp_term_out(GLP_OFF);
adjall = ~((~(AdjWord)0) << m);
adjmatrix = xalloc_adjmatrix();
glp_term_out(GLP_OFF);
+ setlinebuf(stderr);
}
static AdjWord one_adj_bit(int bitnum) {
}
static AdjWord one_adj_bit(int bitnum) {
@@
-332,7
+338,7
@@
static void optimise(bool doprint) {
out:
if (prob)
glp_delete_prob(prob);
out:
if (prob)
glp_delete_prob(prob);
- if (doprint)
{ PRINTF(" \r"); fflush(stdout); }
+ if (doprint)
progress_eol();
}
static void iterate_recurse(int i, AdjWord min) {
}
static void iterate_recurse(int i, AdjWord min) {