summaryrefslogtreecommitdiff
path: root/src/rps/rps-test_util.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-10-20 14:21:02 +0200
committerJulius Bünger <buenger@mytum.de>2018-10-20 14:47:31 +0200
commitd2bdef77c4f13b1e51ac72340b7e1cc1535f6bb3 (patch)
tree25b0af7a6fb8389827e0cf7fbb22730bda266ee0 /src/rps/rps-test_util.c
parent061e86b157b1f13062ef879656a1c2678a8b6f35 (diff)
RPS: Fix writing internals to disk
Diffstat (limited to 'src/rps/rps-test_util.c')
-rw-r--r--src/rps/rps-test_util.c72
1 files changed, 1 insertions, 71 deletions
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index ffd43f6b1..f3367e01b 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -57,76 +57,6 @@ static char buf_unaligned;
*/
static unsigned num_bits_buf_unaligned;
-void
-to_file_ (const char *file_name, char *line)
-{
- struct GNUNET_DISK_FileHandle *f;
- char output_buffer[512];
- size_t output_buffer_size = 512;
- char *output_buffer_p;
- //size_t size;
- int size;
- int size2;
-
-
- if (NULL == (f = GNUNET_DISK_file_open (file_name,
- GNUNET_DISK_OPEN_APPEND |
- GNUNET_DISK_OPEN_WRITE |
- GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_READ |
- GNUNET_DISK_PERM_USER_WRITE |
- GNUNET_DISK_PERM_GROUP_READ |
- GNUNET_DISK_PERM_OTHER_READ)))
- {
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Not able to open file %s\n",
- file_name);
- return;
- }
- output_buffer_size = strlen (line) + 18;
- if (512 < output_buffer_size)
- {
- output_buffer_p = GNUNET_malloc ((output_buffer_size) * sizeof (char));
- } else {
- output_buffer_p = &output_buffer[0];
- }
- size = GNUNET_snprintf (output_buffer_p,
- output_buffer_size,
- "%llu %s\n",
- (GNUNET_TIME_absolute_get ().abs_value_us) / 1000000, // microsec -> sec
- line);
- if (0 > size)
- {
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Failed to write string to buffer (size: %i)\n",
- size);
- return;
- }
-
- size2 = GNUNET_DISK_file_write (f, output_buffer_p, size);
- if (size != size2)
- {
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Unable to write to file! (Size: %u, size2: %u)\n",
- size,
- size2);
-
- if (GNUNET_YES != GNUNET_DISK_file_close (f))
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Unable to close file\n");
-
- return;
- }
-
- if (512 < output_buffer_size)
- {
- GNUNET_free (output_buffer_p);
- }
-
- if (GNUNET_YES != GNUNET_DISK_file_close (f))
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Unable to close file\n");
-}
void
to_file_raw (const char *file_name, const char *buf, size_t size_buf)
@@ -457,7 +387,7 @@ static int ensure_folder_exist (void)
return GNUNET_YES;
}
-const char *
+char *
store_prefix_file_name (const struct GNUNET_PeerIdentity *peer,
const char *prefix)
{