use fflush for stdout; minor changes

This commit is contained in:
Özgür Kesim 2022-10-03 11:07:14 +02:00
parent 6bda23fb38
commit a423fdb1d0
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7

View File

@ -31,8 +31,6 @@
#include "crypto.h"
#include "util.h"
#define MIN(A, B) ((A) < (B) ? (A) : (B))
struct msg
{
uint16_t sender;
@ -112,11 +110,20 @@ print_result( struct transcript *tr,
"winners",
results));
json_dumpfd(output, 1, JSON_INDENT(2));
{
FILE *f = fdopen (1, "w");
GNUNET_assert(f);
json_dumpf (output, f, JSON_INDENT (2));
fflush (f);
}
json_decref (output);
}
static void
tr_result (void *arg,
cb_result (void *arg,
struct BRANDT_Result results[],
uint16_t results_len)
{
@ -149,14 +156,13 @@ tr_result (void *arg,
tr->expected[i].price);
}
// TODO: compare computed and expected results!
print_result (tr, NULL);
// TODO: compare computed and expected results!
}
static uint16_t
tr_start (void *auction_closure)
cb_start (void *auction_closure)
{
struct transcript *tr = (struct transcript *) auction_closure;
struct cls
@ -200,9 +206,9 @@ replay_transcript (void *arg)
"REPLAY calling BRANDT_new with %s outcome.\n",
tr->public ? "public" : "private");
tr->auction = BRANDT_new (&tr_result,
tr->auction = BRANDT_new (&cb_result,
NULL,
&tr_start,
&cb_start,
tr,
&desc,
&desc_len,
@ -217,7 +223,6 @@ replay_transcript (void *arg)
print_result (NULL, "REPLAY BRANDT_new() failed.");
_exit (1);
}
}
@ -451,6 +456,7 @@ main (int argc, char *argv[])
tr.edc = GNUNET_CRYPTO_ecc_dlog_prepare (1024 * 1024 * 40, 1024);
GNUNET_SCHEDULER_run (&replay_transcript, &tr);
GNUNET_CRYPTO_ecc_dlog_release (tr.edc);
GNUNET_free (tr.msgs);
return ret;
}