[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: rps test: be more flexible
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: rps test: be more flexible in printing |
Date: |
Mon, 09 Apr 2018 00:20:10 +0200 |
This is an automated email from the git hooks/post-receive script.
julius-buenger pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new db67f7e2f rps test: be more flexible in printing
db67f7e2f is described below
commit db67f7e2f62e38ee9b7cf5526609431a04f9bc9d
Author: Julius Bünger <address@hidden>
AuthorDate: Mon Apr 9 00:17:57 2018 +0200
rps test: be more flexible in printing
---
src/rps/rps-test_util.h | 10 ++++++++++
src/rps/test_rps.c | 4 +++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h
index e8e352ff6..725be815c 100644
--- a/src/rps/rps-test_util.h
+++ b/src/rps/rps-test_util.h
@@ -58,8 +58,18 @@ create_file (const char *name);
else\
to_file_(file_name,tmp_buf);\
} while (0);
+# define to_file_w_len(file_name, len, ...) do {char tmp_buf[len];\
+ int size;\
+ size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\
+ if (0 > size)\
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\
+ "Failed to create tmp_buf\n");\
+ else\
+ to_file_(file_name,tmp_buf);\
+ } while (0);
#else /* TO_FILE */
# define to_file(file_name, ...)
+# define to_file_w_len(file_name, len, ...)
#endif /* TO_FILE */
#endif /* RPS_TEST_UTIL_H */
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index b4c5e6cb1..b46fc0c1e 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -2017,7 +2017,9 @@ static void compute_probabilities (uint32_t peer_idx)
GNUNET_assert (0 <= tmp);
}
- to_file (rps_peers[peer_idx].file_name_probs, probs_as_str);
+ to_file_w_len (rps_peers[peer_idx].file_name_probs,
+ probs_as_str_size,
+ probs_as_str);
GNUNET_free (probs_as_str);
}
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: rps test: be more flexible in printing,
gnunet <=