diff options
author | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-08 12:33:09 +0000 |
commit | d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb (patch) | |
tree | 9efd18ea7d425652085ed0bd5e8e45604bc5f6b9 /src/rps/rps-test_util.h | |
parent | a0fce305c565c0937d917a92712f15e9c5736260 (diff) | |
download | gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.tar.gz gnunet-d41ed82a4ea0cc8e1674b6d5d2c49fd6462610bb.zip |
uncrustify as demanded.
Diffstat (limited to 'src/rps/rps-test_util.h')
-rw-r--r-- | src/rps/rps-test_util.h | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h index 5aa0688d5..f978059c3 100644 --- a/src/rps/rps-test_util.h +++ b/src/rps/rps-test_util.h | |||
@@ -16,7 +16,7 @@ | |||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file rps/rps-test_util.h | 22 | * @file rps/rps-test_util.h |
@@ -32,10 +32,10 @@ | |||
32 | 32 | ||
33 | 33 | ||
34 | char * | 34 | char * |
35 | auth_key_to_string (struct GNUNET_CRYPTO_AuthKey auth_key); | 35 | auth_key_to_string(struct GNUNET_CRYPTO_AuthKey auth_key); |
36 | 36 | ||
37 | struct GNUNET_CRYPTO_AuthKey | 37 | struct GNUNET_CRYPTO_AuthKey |
38 | string_to_auth_key (const char *str); | 38 | string_to_auth_key(const char *str); |
39 | 39 | ||
40 | 40 | ||
41 | /** | 41 | /** |
@@ -48,7 +48,7 @@ string_to_auth_key (const char *str); | |||
48 | * @return File handle | 48 | * @return File handle |
49 | */ | 49 | */ |
50 | struct GNUNET_DISK_FileHandle * | 50 | struct GNUNET_DISK_FileHandle * |
51 | get_file_handle (const char *name); | 51 | get_file_handle(const char *name); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * @brief Close all files that were opened with #get_file_handle | 54 | * @brief Close all files that were opened with #get_file_handle |
@@ -56,44 +56,44 @@ get_file_handle (const char *name); | |||
56 | * @return Success of iterating over files | 56 | * @return Success of iterating over files |
57 | */ | 57 | */ |
58 | int | 58 | int |
59 | close_all_files (); | 59 | close_all_files(); |
60 | 60 | ||
61 | /** | 61 | /** |
62 | * This function is used to facilitate writing important information to disk | 62 | * This function is used to facilitate writing important information to disk |
63 | */ | 63 | */ |
64 | #ifdef TO_FILE | 64 | #ifdef TO_FILE |
65 | #define to_file(file_name, ...) do { \ | 65 | #define to_file(file_name, ...) do { \ |
66 | char tmp_buf[512] = "";\ | 66 | char tmp_buf[512] = ""; \ |
67 | int size;\ | 67 | int size; \ |
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 | { \ |
72 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ | 72 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, \ |
73 | "Failed to create tmp_buf\n");\ | 73 | "Failed to create tmp_buf\n"); \ |
74 | break;\ | 74 | break; \ |
75 | }\ | 75 | } \ |
76 | (void) strncat(tmp_buf,"\n",512);\ | 76 | (void)strncat(tmp_buf, "\n", 512); \ |
77 | GNUNET_DISK_file_write (get_file_handle (file_name),\ | 77 | GNUNET_DISK_file_write(get_file_handle(file_name), \ |
78 | tmp_buf,\ | 78 | tmp_buf, \ |
79 | strnlen (tmp_buf, 512));\ | 79 | strnlen(tmp_buf, 512)); \ |
80 | } while (0); | 80 | } while (0); |
81 | 81 | ||
82 | 82 | ||
83 | #define to_file_w_len(file_name, len, ...) do {char tmp_buf[len];\ | 83 | #define to_file_w_len(file_name, len, ...) do { char tmp_buf [len]; \ |
84 | int size;\ | 84 | int size; \ |
85 | memset (tmp_buf, 0, len);\ | 85 | memset(tmp_buf, 0, len); \ |
86 | size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ | 86 | size = GNUNET_snprintf(tmp_buf, sizeof(tmp_buf), __VA_ARGS__); \ |
87 | if (0 > size)\ | 87 | if (0 > size) \ |
88 | {\ | 88 | { \ |
89 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ | 89 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, \ |
90 | "Failed to create tmp_buf\n");\ | 90 | "Failed to create tmp_buf\n"); \ |
91 | break;\ | 91 | break; \ |
92 | }\ | 92 | } \ |
93 | (void) strncat(tmp_buf,"\n",len);\ | 93 | (void)strncat(tmp_buf, "\n", len); \ |
94 | GNUNET_DISK_file_write (get_file_handle (file_name),\ | 94 | GNUNET_DISK_file_write(get_file_handle(file_name), \ |
95 | tmp_buf,\ | 95 | tmp_buf, \ |
96 | strnlen (tmp_buf, len));\ | 96 | strnlen(tmp_buf, len)); \ |
97 | } while (0); | 97 | } while (0); |
98 | #else /* TO_FILE */ | 98 | #else /* TO_FILE */ |
99 | # define to_file(file_name, ...) | 99 | # define to_file(file_name, ...) |
@@ -101,17 +101,17 @@ close_all_files (); | |||
101 | #endif /* TO_FILE */ | 101 | #endif /* TO_FILE */ |
102 | 102 | ||
103 | char * | 103 | char * |
104 | store_prefix_file_name (const unsigned int index, | 104 | store_prefix_file_name(const unsigned int index, |
105 | const char *prefix); | 105 | const char *prefix); |
106 | 106 | ||
107 | void | 107 | void |
108 | to_file_raw (const char *file_name, const char *buf, size_t size_buf); | 108 | to_file_raw(const char *file_name, const char *buf, size_t size_buf); |
109 | 109 | ||
110 | void | 110 | void |
111 | to_file_raw_unaligned (const char *file_name, | 111 | to_file_raw_unaligned(const char *file_name, |
112 | const char *buf, | 112 | const char *buf, |
113 | size_t size_buf, | 113 | size_t size_buf, |
114 | unsigned bits_needed); | 114 | unsigned bits_needed); |
115 | 115 | ||
116 | 116 | ||
117 | /** | 117 | /** |
@@ -121,7 +121,7 @@ to_file_raw_unaligned (const char *file_name, | |||
121 | * | 121 | * |
122 | * @return Factorial of @a x | 122 | * @return Factorial of @a x |
123 | */ | 123 | */ |
124 | uint32_t fac (uint32_t x); | 124 | uint32_t fac(uint32_t x); |
125 | 125 | ||
126 | 126 | ||
127 | /** | 127 | /** |
@@ -132,7 +132,7 @@ uint32_t fac (uint32_t x); | |||
132 | * | 132 | * |
133 | * @return Binomial coefficient of @a n and @a k | 133 | * @return Binomial coefficient of @a n and @a k |
134 | */ | 134 | */ |
135 | uint32_t binom (uint32_t n, uint32_t k); | 135 | uint32_t binom(uint32_t n, uint32_t k); |
136 | 136 | ||
137 | #endif /* RPS_TEST_UTIL_H */ | 137 | #endif /* RPS_TEST_UTIL_H */ |
138 | /* end of gnunet-service-rps.c */ | 138 | /* end of gnunet-service-rps.c */ |