diff options
author | Julius Bünger <buenger@mytum.de> | 2019-04-08 16:03:42 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2019-04-08 16:03:42 +0200 |
commit | 676339f8b08099062248ed297e0e13fa9a9f6e42 (patch) | |
tree | 9fe50edc854153f2259708fe42f4d2d2876017d8 | |
parent | ba49954276e1f04c1d3b6e1861be617882783e54 (diff) | |
download | gnunet-676339f8b08099062248ed297e0e13fa9a9f6e42.tar.gz gnunet-676339f8b08099062248ed297e0e13fa9a9f6e42.zip |
RPS data extraction: Format written files
-rw-r--r-- | src/rps/gnunet-rps-profiler.c | 2 | ||||
-rw-r--r-- | src/rps/rps-test_util.h | 34 |
2 files changed, 27 insertions, 9 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index ffc9d6f7e..a13ee4078 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c | |||
@@ -2222,7 +2222,7 @@ static void compute_probabilities (uint32_t peer_idx) | |||
2222 | { | 2222 | { |
2223 | //double probs[num_peers] = { 0 }; | 2223 | //double probs[num_peers] = { 0 }; |
2224 | double probs[num_peers]; | 2224 | double probs[num_peers]; |
2225 | size_t probs_as_str_size = (num_peers * 10 + 1) * sizeof (char); | 2225 | size_t probs_as_str_size = (num_peers * 10 + 2) * sizeof (char); |
2226 | char *probs_as_str = GNUNET_malloc (probs_as_str_size); | 2226 | char *probs_as_str = GNUNET_malloc (probs_as_str_size); |
2227 | char *probs_as_str_cpy; | 2227 | char *probs_as_str_cpy; |
2228 | uint32_t i; | 2228 | uint32_t i; |
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h index 6b5f568d7..3094b9bea 100644 --- a/src/rps/rps-test_util.h +++ b/src/rps/rps-test_util.h | |||
@@ -68,12 +68,21 @@ close_all_files (); | |||
68 | if (NULL == file_name) break; \ | 68 | if (NULL == file_name) break; \ |
69 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ | 69 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ |
70 | if (0 > size)\ | 70 | if (0 > size)\ |
71 | {\ | ||
71 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ | 72 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ |
72 | "Failed to create tmp_buf\n");\ | 73 | "Failed to create tmp_buf\n");\ |
73 | else\ | 74 | break;\ |
74 | GNUNET_DISK_file_write (get_file_handle (file_name),\ | 75 | }\ |
75 | tmp_buf,\ | 76 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),"%s \n", tmp_buf);\ |
76 | strnlen (tmp_buf, 512));\ | 77 | if (0 > size)\ |
78 | {\ | ||
79 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ | ||
80 | "Failed to create tmp_buf\n");\ | ||
81 | break;\ | ||
82 | }\ | ||
83 | GNUNET_DISK_file_write (get_file_handle (file_name),\ | ||
84 | tmp_buf,\ | ||
85 | strnlen (tmp_buf, 512));\ | ||
77 | } while (0); | 86 | } while (0); |
78 | 87 | ||
79 | 88 | ||
@@ -82,12 +91,21 @@ close_all_files (); | |||
82 | memset (tmp_buf, 0, len);\ | 91 | memset (tmp_buf, 0, len);\ |
83 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ | 92 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ |
84 | if (0 > size)\ | 93 | if (0 > size)\ |
94 | {\ | ||
95 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ | ||
96 | "Failed to create tmp_buf\n");\ | ||
97 | break;\ | ||
98 | }\ | ||
99 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),"%s\n", tmp_buf);\ | ||
100 | if (0 > size)\ | ||
101 | {\ | ||
85 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ | 102 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ |
86 | "Failed to create tmp_buf\n");\ | 103 | "Failed to create tmp_buf\n");\ |
87 | else\ | 104 | break;\ |
88 | GNUNET_DISK_file_write (get_file_handle (file_name),\ | 105 | }\ |
89 | tmp_buf,\ | 106 | GNUNET_DISK_file_write (get_file_handle (file_name),\ |
90 | strnlen (tmp_buf, 512));\ | 107 | tmp_buf,\ |
108 | strnlen (tmp_buf, len));\ | ||
91 | } while (0); | 109 | } while (0); |
92 | #else /* TO_FILE */ | 110 | #else /* TO_FILE */ |
93 | # define to_file(file_name, ...) | 111 | # define to_file(file_name, ...) |