gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated: RPS data extraction: Format


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: RPS data extraction: Format written files
Date: Mon, 08 Apr 2019 16:04:31 +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 676339f8b RPS data extraction: Format written files
676339f8b is described below

commit 676339f8b08099062248ed297e0e13fa9a9f6e42
Author: Julius Bünger <address@hidden>
AuthorDate: Mon Apr 8 16:03:42 2019 +0200

    RPS data extraction: Format written files
---
 src/rps/gnunet-rps-profiler.c |  2 +-
 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)
 {
   //double probs[num_peers] = { 0 };
   double probs[num_peers];
-  size_t probs_as_str_size = (num_peers * 10 + 1) * sizeof (char);
+  size_t probs_as_str_size = (num_peers * 10 + 2) * sizeof (char);
   char *probs_as_str = GNUNET_malloc (probs_as_str_size);
   char *probs_as_str_cpy;
   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 ();
     if (NULL == file_name) break; \
     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\
-      GNUNET_DISK_file_write (get_file_handle (file_name),\
-                              tmp_buf,\
-                              strnlen (tmp_buf, 512));\
+      break;\
+    }\
+    size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),"%s \n", tmp_buf);\
+    if (0 > size)\
+    {\
+      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\
+           "Failed to create tmp_buf\n");\
+      break;\
+    }\
+    GNUNET_DISK_file_write (get_file_handle (file_name),\
+                            tmp_buf,\
+                            strnlen (tmp_buf, 512));\
   } while (0);
 
 
@@ -82,12 +91,21 @@ close_all_files ();
     memset (tmp_buf, 0, len);\
     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");\
+      break;\
+    }\
+    size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),"%s\n", tmp_buf);\
+    if (0 > size)\
+    {\
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\
            "Failed to create tmp_buf\n");\
-    else\
-      GNUNET_DISK_file_write (get_file_handle (file_name),\
-                              tmp_buf,\
-                              strnlen (tmp_buf, 512));\
+      break;\
+    }\
+    GNUNET_DISK_file_write (get_file_handle (file_name),\
+                            tmp_buf,\
+                            strnlen (tmp_buf, len));\
   } while (0);
 #else /* TO_FILE */
 #  define to_file(file_name, ...)

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]