diff options
Diffstat (limited to 'src/rps/rps-test_util.h')
-rw-r--r-- | src/rps/rps-test_util.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h index 2e6560723..11093420e 100644 --- a/src/rps/rps-test_util.h +++ b/src/rps/rps-test_util.h | |||
@@ -29,9 +29,6 @@ | |||
29 | #define TO_FILE 1 | 29 | #define TO_FILE 1 |
30 | 30 | ||
31 | 31 | ||
32 | void | ||
33 | to_file_ (const char *file_name, char *line); | ||
34 | |||
35 | char * | 32 | char * |
36 | auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key); | 33 | auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key); |
37 | 34 | ||
@@ -45,23 +42,33 @@ create_file (const char *name); | |||
45 | * This function is used to facilitate writing important information to disk | 42 | * This function is used to facilitate writing important information to disk |
46 | */ | 43 | */ |
47 | #ifdef TO_FILE | 44 | #ifdef TO_FILE |
48 | # define to_file(file_name, ...) do {char tmp_buf[512];\ | 45 | # define to_file(file_name, ...) do {char tmp_buf[512] = "";\ |
49 | int size;\ | 46 | int size;\ |
50 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ | 47 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ |
51 | if (0 > size)\ | 48 | if (0 > size)\ |
52 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ | 49 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ |
53 | "Failed to create tmp_buf\n");\ | 50 | "Failed to create tmp_buf\n");\ |
54 | else\ | 51 | else\ |
55 | to_file_(file_name,tmp_buf);\ | 52 | GNUNET_DISK_fn_write(file_name,tmp_buf, sizeof(tmp_buf),\ |
53 | GNUNET_DISK_PERM_USER_READ |\ | ||
54 | GNUNET_DISK_PERM_USER_WRITE |\ | ||
55 | GNUNET_DISK_PERM_GROUP_READ |\ | ||
56 | GNUNET_DISK_PERM_OTHER_READ);\ | ||
56 | } while (0); | 57 | } while (0); |
57 | # define to_file_w_len(file_name, len, ...) do {char tmp_buf[len];\ | 58 | |
59 | #define to_file_w_len(file_name, len, ...) do {char tmp_buf[len];\ | ||
58 | int size;\ | 60 | int size;\ |
61 | memset (tmp_buf, 0, len);\ | ||
59 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ | 62 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ |
60 | if (0 > size)\ | 63 | if (0 > size)\ |
61 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ | 64 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ |
62 | "Failed to create tmp_buf\n");\ | 65 | "Failed to create tmp_buf\n");\ |
63 | else\ | 66 | else\ |
64 | to_file_(file_name,tmp_buf);\ | 67 | GNUNET_DISK_fn_write(file_name,tmp_buf, len, \ |
68 | GNUNET_DISK_PERM_USER_READ |\ | ||
69 | GNUNET_DISK_PERM_USER_WRITE |\ | ||
70 | GNUNET_DISK_PERM_GROUP_READ |\ | ||
71 | GNUNET_DISK_PERM_OTHER_READ);\ | ||
65 | } while (0); | 72 | } while (0); |
66 | #else /* TO_FILE */ | 73 | #else /* TO_FILE */ |
67 | # define to_file(file_name, ...) | 74 | # define to_file(file_name, ...) |