diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-10-05 15:09:28 +0200 |
commit | c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207 (patch) | |
tree | cac3ce030d77b4cbe7c7dc62ed58cfe6d24f73e1 /src/pq/pq_result_helper.c | |
parent | fbb71d527c7d6babf269a8fefce1db291b9f7068 (diff) | |
download | gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.tar.gz gnunet-c4e9ba925ffd758aaa3feee2ccfc0b76f26fe207.zip |
global reindent, now with uncrustify hook enabled
Diffstat (limited to 'src/pq/pq_result_helper.c')
-rw-r--r-- | src/pq/pq_result_helper.c | 714 |
1 files changed, 357 insertions, 357 deletions
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c index 89c0207f7..cfb16ac12 100644 --- a/src/pq/pq_result_helper.c +++ b/src/pq/pq_result_helper.c | |||
@@ -35,17 +35,17 @@ | |||
35 | * @param rd result data to clean up | 35 | * @param rd result data to clean up |
36 | */ | 36 | */ |
37 | static void | 37 | static void |
38 | clean_varsize_blob(void *cls, | 38 | clean_varsize_blob (void *cls, |
39 | void *rd) | 39 | void *rd) |
40 | { | 40 | { |
41 | void **dst = rd; | 41 | void **dst = rd; |
42 | 42 | ||
43 | (void)cls; | 43 | (void) cls; |
44 | if (NULL != *dst) | 44 | if (NULL != *dst) |
45 | { | 45 | { |
46 | GNUNET_free(*dst); | 46 | GNUNET_free (*dst); |
47 | *dst = NULL; | 47 | *dst = NULL; |
48 | } | 48 | } |
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
@@ -63,51 +63,51 @@ clean_varsize_blob(void *cls, | |||
63 | * #GNUNET_SYSERR if a result was invalid (non-existing field) | 63 | * #GNUNET_SYSERR if a result was invalid (non-existing field) |
64 | */ | 64 | */ |
65 | static int | 65 | static int |
66 | extract_varsize_blob(void *cls, | 66 | extract_varsize_blob (void *cls, |
67 | PGresult *result, | 67 | PGresult *result, |
68 | int row, | 68 | int row, |
69 | const char *fname, | 69 | const char *fname, |
70 | size_t *dst_size, | 70 | size_t *dst_size, |
71 | void *dst) | 71 | void *dst) |
72 | { | 72 | { |
73 | size_t len; | 73 | size_t len; |
74 | const char *res; | 74 | const char *res; |
75 | void *idst; | 75 | void *idst; |
76 | int fnum; | 76 | int fnum; |
77 | 77 | ||
78 | (void)cls; | 78 | (void) cls; |
79 | *dst_size = 0; | 79 | *dst_size = 0; |
80 | *((void **)dst) = NULL; | 80 | *((void **) dst) = NULL; |
81 | 81 | ||
82 | fnum = PQfnumber(result, | 82 | fnum = PQfnumber (result, |
83 | fname); | 83 | fname); |
84 | if (fnum < 0) | 84 | if (fnum < 0) |
85 | { | 85 | { |
86 | GNUNET_break(0); | 86 | GNUNET_break (0); |
87 | return GNUNET_SYSERR; | 87 | return GNUNET_SYSERR; |
88 | } | 88 | } |
89 | if (PQgetisnull(result, | 89 | if (PQgetisnull (result, |
90 | row, | 90 | row, |
91 | fnum)) | 91 | fnum)) |
92 | { | 92 | { |
93 | /* Let's allow this for varsize */ | 93 | /* Let's allow this for varsize */ |
94 | return GNUNET_OK; | 94 | return GNUNET_OK; |
95 | } | 95 | } |
96 | /* if a field is null, continue but | 96 | /* if a field is null, continue but |
97 | * remember that we now return a different result */ | 97 | * remember that we now return a different result */ |
98 | len = PQgetlength(result, | 98 | len = PQgetlength (result, |
99 | row, | ||
100 | fnum); | ||
101 | res = PQgetvalue (result, | ||
99 | row, | 102 | row, |
100 | fnum); | 103 | fnum); |
101 | res = PQgetvalue(result, | 104 | GNUNET_assert (NULL != res); |
102 | row, | ||
103 | fnum); | ||
104 | GNUNET_assert(NULL != res); | ||
105 | *dst_size = len; | 105 | *dst_size = len; |
106 | idst = GNUNET_malloc(len); | 106 | idst = GNUNET_malloc (len); |
107 | *((void **)dst) = idst; | 107 | *((void **) dst) = idst; |
108 | GNUNET_memcpy(idst, | 108 | GNUNET_memcpy (idst, |
109 | res, | 109 | res, |
110 | len); | 110 | len); |
111 | return GNUNET_OK; | 111 | return GNUNET_OK; |
112 | } | 112 | } |
113 | 113 | ||
@@ -121,14 +121,14 @@ extract_varsize_blob(void *cls, | |||
121 | * @return array entry for the result specification to use | 121 | * @return array entry for the result specification to use |
122 | */ | 122 | */ |
123 | struct GNUNET_PQ_ResultSpec | 123 | struct GNUNET_PQ_ResultSpec |
124 | GNUNET_PQ_result_spec_variable_size(const char *name, | 124 | GNUNET_PQ_result_spec_variable_size (const char *name, |
125 | void **dst, | 125 | void **dst, |
126 | size_t *sptr) | 126 | size_t *sptr) |
127 | { | 127 | { |
128 | struct GNUNET_PQ_ResultSpec res = | 128 | struct GNUNET_PQ_ResultSpec res = |
129 | { &extract_varsize_blob, | 129 | { &extract_varsize_blob, |
130 | &clean_varsize_blob, NULL, | 130 | &clean_varsize_blob, NULL, |
131 | (void *)(dst), 0, name, sptr }; | 131 | (void *) (dst), 0, name, sptr }; |
132 | 132 | ||
133 | return res; | 133 | return res; |
134 | } | 134 | } |
@@ -148,50 +148,50 @@ GNUNET_PQ_result_spec_variable_size(const char *name, | |||
148 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) | 148 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) |
149 | */ | 149 | */ |
150 | static int | 150 | static int |
151 | extract_fixed_blob(void *cls, | 151 | extract_fixed_blob (void *cls, |
152 | PGresult *result, | 152 | PGresult *result, |
153 | int row, | 153 | int row, |
154 | const char *fname, | 154 | const char *fname, |
155 | size_t *dst_size, | 155 | size_t *dst_size, |
156 | void *dst) | 156 | void *dst) |
157 | { | 157 | { |
158 | size_t len; | 158 | size_t len; |
159 | const char *res; | 159 | const char *res; |
160 | int fnum; | 160 | int fnum; |
161 | 161 | ||
162 | (void)cls; | 162 | (void) cls; |
163 | fnum = PQfnumber(result, | 163 | fnum = PQfnumber (result, |
164 | fname); | 164 | fname); |
165 | if (fnum < 0) | 165 | if (fnum < 0) |
166 | { | 166 | { |
167 | GNUNET_break(0); | 167 | GNUNET_break (0); |
168 | return GNUNET_SYSERR; | 168 | return GNUNET_SYSERR; |
169 | } | 169 | } |
170 | if (PQgetisnull(result, | 170 | if (PQgetisnull (result, |
171 | row, | 171 | row, |
172 | fnum)) | 172 | fnum)) |
173 | { | 173 | { |
174 | GNUNET_break(0); | 174 | GNUNET_break (0); |
175 | return GNUNET_SYSERR; | 175 | return GNUNET_SYSERR; |
176 | } | 176 | } |
177 | 177 | ||
178 | /* if a field is null, continue but | 178 | /* if a field is null, continue but |
179 | * remember that we now return a different result */ | 179 | * remember that we now return a different result */ |
180 | len = PQgetlength(result, | 180 | len = PQgetlength (result, |
181 | row, | ||
182 | fnum); | ||
183 | if (*dst_size != len) | ||
184 | { | ||
185 | GNUNET_break (0); | ||
186 | return GNUNET_SYSERR; | ||
187 | } | ||
188 | res = PQgetvalue (result, | ||
181 | row, | 189 | row, |
182 | fnum); | 190 | fnum); |
183 | if (*dst_size != len) | 191 | GNUNET_assert (NULL != res); |
184 | { | 192 | GNUNET_memcpy (dst, |
185 | GNUNET_break(0); | 193 | res, |
186 | return GNUNET_SYSERR; | 194 | len); |
187 | } | ||
188 | res = PQgetvalue(result, | ||
189 | row, | ||
190 | fnum); | ||
191 | GNUNET_assert(NULL != res); | ||
192 | GNUNET_memcpy(dst, | ||
193 | res, | ||
194 | len); | ||
195 | return GNUNET_OK; | 195 | return GNUNET_OK; |
196 | } | 196 | } |
197 | 197 | ||
@@ -205,9 +205,9 @@ extract_fixed_blob(void *cls, | |||
205 | * @return array entry for the result specification to use | 205 | * @return array entry for the result specification to use |
206 | */ | 206 | */ |
207 | struct GNUNET_PQ_ResultSpec | 207 | struct GNUNET_PQ_ResultSpec |
208 | GNUNET_PQ_result_spec_fixed_size(const char *name, | 208 | GNUNET_PQ_result_spec_fixed_size (const char *name, |
209 | void *dst, | 209 | void *dst, |
210 | size_t dst_size) | 210 | size_t dst_size) |
211 | { | 211 | { |
212 | struct GNUNET_PQ_ResultSpec res = | 212 | struct GNUNET_PQ_ResultSpec res = |
213 | { &extract_fixed_blob, | 213 | { &extract_fixed_blob, |
@@ -232,49 +232,49 @@ GNUNET_PQ_result_spec_fixed_size(const char *name, | |||
232 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) | 232 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) |
233 | */ | 233 | */ |
234 | static int | 234 | static int |
235 | extract_rsa_public_key(void *cls, | 235 | extract_rsa_public_key (void *cls, |
236 | PGresult *result, | 236 | PGresult *result, |
237 | int row, | 237 | int row, |
238 | const char *fname, | 238 | const char *fname, |
239 | size_t *dst_size, | 239 | size_t *dst_size, |
240 | void *dst) | 240 | void *dst) |
241 | { | 241 | { |
242 | struct GNUNET_CRYPTO_RsaPublicKey **pk = dst; | 242 | struct GNUNET_CRYPTO_RsaPublicKey **pk = dst; |
243 | size_t len; | 243 | size_t len; |
244 | const char *res; | 244 | const char *res; |
245 | int fnum; | 245 | int fnum; |
246 | 246 | ||
247 | (void)cls; | 247 | (void) cls; |
248 | *pk = NULL; | 248 | *pk = NULL; |
249 | fnum = PQfnumber(result, | 249 | fnum = PQfnumber (result, |
250 | fname); | 250 | fname); |
251 | if (fnum < 0) | 251 | if (fnum < 0) |
252 | { | 252 | { |
253 | GNUNET_break(0); | 253 | GNUNET_break (0); |
254 | return GNUNET_SYSERR; | 254 | return GNUNET_SYSERR; |
255 | } | 255 | } |
256 | if (PQgetisnull(result, | 256 | if (PQgetisnull (result, |
257 | row, | 257 | row, |
258 | fnum)) | 258 | fnum)) |
259 | { | 259 | { |
260 | GNUNET_break(0); | 260 | GNUNET_break (0); |
261 | return GNUNET_SYSERR; | 261 | return GNUNET_SYSERR; |
262 | } | 262 | } |
263 | /* if a field is null, continue but | 263 | /* if a field is null, continue but |
264 | * remember that we now return a different result */ | 264 | * remember that we now return a different result */ |
265 | len = PQgetlength(result, | 265 | len = PQgetlength (result, |
266 | row, | ||
267 | fnum); | ||
268 | res = PQgetvalue (result, | ||
266 | row, | 269 | row, |
267 | fnum); | 270 | fnum); |
268 | res = PQgetvalue(result, | 271 | *pk = GNUNET_CRYPTO_rsa_public_key_decode (res, |
269 | row, | 272 | len); |
270 | fnum); | ||
271 | *pk = GNUNET_CRYPTO_rsa_public_key_decode(res, | ||
272 | len); | ||
273 | if (NULL == *pk) | 273 | if (NULL == *pk) |
274 | { | 274 | { |
275 | GNUNET_break(0); | 275 | GNUNET_break (0); |
276 | return GNUNET_SYSERR; | 276 | return GNUNET_SYSERR; |
277 | } | 277 | } |
278 | return GNUNET_OK; | 278 | return GNUNET_OK; |
279 | } | 279 | } |
280 | 280 | ||
@@ -287,17 +287,17 @@ extract_rsa_public_key(void *cls, | |||
287 | * @param rd result data to clean up | 287 | * @param rd result data to clean up |
288 | */ | 288 | */ |
289 | static void | 289 | static void |
290 | clean_rsa_public_key(void *cls, | 290 | clean_rsa_public_key (void *cls, |
291 | void *rd) | 291 | void *rd) |
292 | { | 292 | { |
293 | struct GNUNET_CRYPTO_RsaPublicKey **pk = rd; | 293 | struct GNUNET_CRYPTO_RsaPublicKey **pk = rd; |
294 | 294 | ||
295 | (void)cls; | 295 | (void) cls; |
296 | if (NULL != *pk) | 296 | if (NULL != *pk) |
297 | { | 297 | { |
298 | GNUNET_CRYPTO_rsa_public_key_free(*pk); | 298 | GNUNET_CRYPTO_rsa_public_key_free (*pk); |
299 | *pk = NULL; | 299 | *pk = NULL; |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
@@ -309,14 +309,14 @@ clean_rsa_public_key(void *cls, | |||
309 | * @return array entry for the result specification to use | 309 | * @return array entry for the result specification to use |
310 | */ | 310 | */ |
311 | struct GNUNET_PQ_ResultSpec | 311 | struct GNUNET_PQ_ResultSpec |
312 | GNUNET_PQ_result_spec_rsa_public_key(const char *name, | 312 | GNUNET_PQ_result_spec_rsa_public_key (const char *name, |
313 | struct GNUNET_CRYPTO_RsaPublicKey **rsa) | 313 | struct GNUNET_CRYPTO_RsaPublicKey **rsa) |
314 | { | 314 | { |
315 | struct GNUNET_PQ_ResultSpec res = | 315 | struct GNUNET_PQ_ResultSpec res = |
316 | { &extract_rsa_public_key, | 316 | { &extract_rsa_public_key, |
317 | &clean_rsa_public_key, | 317 | &clean_rsa_public_key, |
318 | NULL, | 318 | NULL, |
319 | (void *)rsa, 0, name, NULL }; | 319 | (void *) rsa, 0, name, NULL }; |
320 | 320 | ||
321 | return res; | 321 | return res; |
322 | } | 322 | } |
@@ -336,49 +336,49 @@ GNUNET_PQ_result_spec_rsa_public_key(const char *name, | |||
336 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) | 336 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) |
337 | */ | 337 | */ |
338 | static int | 338 | static int |
339 | extract_rsa_signature(void *cls, | 339 | extract_rsa_signature (void *cls, |
340 | PGresult *result, | 340 | PGresult *result, |
341 | int row, | 341 | int row, |
342 | const char *fname, | 342 | const char *fname, |
343 | size_t *dst_size, | 343 | size_t *dst_size, |
344 | void *dst) | 344 | void *dst) |
345 | { | 345 | { |
346 | struct GNUNET_CRYPTO_RsaSignature **sig = dst; | 346 | struct GNUNET_CRYPTO_RsaSignature **sig = dst; |
347 | size_t len; | 347 | size_t len; |
348 | const char *res; | 348 | const char *res; |
349 | int fnum; | 349 | int fnum; |
350 | 350 | ||
351 | (void)cls; | 351 | (void) cls; |
352 | *sig = NULL; | 352 | *sig = NULL; |
353 | fnum = PQfnumber(result, | 353 | fnum = PQfnumber (result, |
354 | fname); | 354 | fname); |
355 | if (fnum < 0) | 355 | if (fnum < 0) |
356 | { | 356 | { |
357 | GNUNET_break(0); | 357 | GNUNET_break (0); |
358 | return GNUNET_SYSERR; | 358 | return GNUNET_SYSERR; |
359 | } | 359 | } |
360 | if (PQgetisnull(result, | 360 | if (PQgetisnull (result, |
361 | row, | 361 | row, |
362 | fnum)) | 362 | fnum)) |
363 | { | 363 | { |
364 | GNUNET_break(0); | 364 | GNUNET_break (0); |
365 | return GNUNET_SYSERR; | 365 | return GNUNET_SYSERR; |
366 | } | 366 | } |
367 | /* if a field is null, continue but | 367 | /* if a field is null, continue but |
368 | * remember that we now return a different result */ | 368 | * remember that we now return a different result */ |
369 | len = PQgetlength(result, | 369 | len = PQgetlength (result, |
370 | row, | ||
371 | fnum); | ||
372 | res = PQgetvalue (result, | ||
370 | row, | 373 | row, |
371 | fnum); | 374 | fnum); |
372 | res = PQgetvalue(result, | 375 | *sig = GNUNET_CRYPTO_rsa_signature_decode (res, |
373 | row, | 376 | len); |
374 | fnum); | ||
375 | *sig = GNUNET_CRYPTO_rsa_signature_decode(res, | ||
376 | len); | ||
377 | if (NULL == *sig) | 377 | if (NULL == *sig) |
378 | { | 378 | { |
379 | GNUNET_break(0); | 379 | GNUNET_break (0); |
380 | return GNUNET_SYSERR; | 380 | return GNUNET_SYSERR; |
381 | } | 381 | } |
382 | return GNUNET_OK; | 382 | return GNUNET_OK; |
383 | } | 383 | } |
384 | 384 | ||
@@ -391,17 +391,17 @@ extract_rsa_signature(void *cls, | |||
391 | * @param rd result data to clean up | 391 | * @param rd result data to clean up |
392 | */ | 392 | */ |
393 | static void | 393 | static void |
394 | clean_rsa_signature(void *cls, | 394 | clean_rsa_signature (void *cls, |
395 | void *rd) | 395 | void *rd) |
396 | { | 396 | { |
397 | struct GNUNET_CRYPTO_RsaSignature **sig = rd; | 397 | struct GNUNET_CRYPTO_RsaSignature **sig = rd; |
398 | 398 | ||
399 | (void)cls; | 399 | (void) cls; |
400 | if (NULL != *sig) | 400 | if (NULL != *sig) |
401 | { | 401 | { |
402 | GNUNET_CRYPTO_rsa_signature_free(*sig); | 402 | GNUNET_CRYPTO_rsa_signature_free (*sig); |
403 | *sig = NULL; | 403 | *sig = NULL; |
404 | } | 404 | } |
405 | } | 405 | } |
406 | 406 | ||
407 | 407 | ||
@@ -413,14 +413,14 @@ clean_rsa_signature(void *cls, | |||
413 | * @return array entry for the result specification to use | 413 | * @return array entry for the result specification to use |
414 | */ | 414 | */ |
415 | struct GNUNET_PQ_ResultSpec | 415 | struct GNUNET_PQ_ResultSpec |
416 | GNUNET_PQ_result_spec_rsa_signature(const char *name, | 416 | GNUNET_PQ_result_spec_rsa_signature (const char *name, |
417 | struct GNUNET_CRYPTO_RsaSignature **sig) | 417 | struct GNUNET_CRYPTO_RsaSignature **sig) |
418 | { | 418 | { |
419 | struct GNUNET_PQ_ResultSpec res = | 419 | struct GNUNET_PQ_ResultSpec res = |
420 | { &extract_rsa_signature, | 420 | { &extract_rsa_signature, |
421 | &clean_rsa_signature, | 421 | &clean_rsa_signature, |
422 | NULL, | 422 | NULL, |
423 | (void *)sig, 0, (name), NULL }; | 423 | (void *) sig, 0, (name), NULL }; |
424 | 424 | ||
425 | return res; | 425 | return res; |
426 | } | 426 | } |
@@ -440,49 +440,49 @@ GNUNET_PQ_result_spec_rsa_signature(const char *name, | |||
440 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) | 440 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) |
441 | */ | 441 | */ |
442 | static int | 442 | static int |
443 | extract_string(void *cls, | 443 | extract_string (void *cls, |
444 | PGresult *result, | 444 | PGresult *result, |
445 | int row, | 445 | int row, |
446 | const char *fname, | 446 | const char *fname, |
447 | size_t *dst_size, | 447 | size_t *dst_size, |
448 | void *dst) | 448 | void *dst) |
449 | { | 449 | { |
450 | char **str = dst; | 450 | char **str = dst; |
451 | size_t len; | 451 | size_t len; |
452 | const char *res; | 452 | const char *res; |
453 | int fnum; | 453 | int fnum; |
454 | 454 | ||
455 | (void)cls; | 455 | (void) cls; |
456 | *str = NULL; | 456 | *str = NULL; |
457 | fnum = PQfnumber(result, | 457 | fnum = PQfnumber (result, |
458 | fname); | 458 | fname); |
459 | if (fnum < 0) | 459 | if (fnum < 0) |
460 | { | 460 | { |
461 | GNUNET_break(0); | 461 | GNUNET_break (0); |
462 | return GNUNET_SYSERR; | 462 | return GNUNET_SYSERR; |
463 | } | 463 | } |
464 | if (PQgetisnull(result, | 464 | if (PQgetisnull (result, |
465 | row, | 465 | row, |
466 | fnum)) | 466 | fnum)) |
467 | { | 467 | { |
468 | GNUNET_break(0); | 468 | GNUNET_break (0); |
469 | return GNUNET_SYSERR; | 469 | return GNUNET_SYSERR; |
470 | } | 470 | } |
471 | /* if a field is null, continue but | 471 | /* if a field is null, continue but |
472 | * remember that we now return a different result */ | 472 | * remember that we now return a different result */ |
473 | len = PQgetlength(result, | 473 | len = PQgetlength (result, |
474 | row, | ||
475 | fnum); | ||
476 | res = PQgetvalue (result, | ||
474 | row, | 477 | row, |
475 | fnum); | 478 | fnum); |
476 | res = PQgetvalue(result, | 479 | *str = GNUNET_strndup (res, |
477 | row, | 480 | len); |
478 | fnum); | ||
479 | *str = GNUNET_strndup(res, | ||
480 | len); | ||
481 | if (NULL == *str) | 481 | if (NULL == *str) |
482 | { | 482 | { |
483 | GNUNET_break(0); | 483 | GNUNET_break (0); |
484 | return GNUNET_SYSERR; | 484 | return GNUNET_SYSERR; |
485 | } | 485 | } |
486 | return GNUNET_OK; | 486 | return GNUNET_OK; |
487 | } | 487 | } |
488 | 488 | ||
@@ -495,17 +495,17 @@ extract_string(void *cls, | |||
495 | * @param rd result data to clean up | 495 | * @param rd result data to clean up |
496 | */ | 496 | */ |
497 | static void | 497 | static void |
498 | clean_string(void *cls, | 498 | clean_string (void *cls, |
499 | void *rd) | 499 | void *rd) |
500 | { | 500 | { |
501 | char **str = rd; | 501 | char **str = rd; |
502 | 502 | ||
503 | (void)cls; | 503 | (void) cls; |
504 | if (NULL != *str) | 504 | if (NULL != *str) |
505 | { | 505 | { |
506 | GNUNET_free(*str); | 506 | GNUNET_free (*str); |
507 | *str = NULL; | 507 | *str = NULL; |
508 | } | 508 | } |
509 | } | 509 | } |
510 | 510 | ||
511 | 511 | ||
@@ -517,14 +517,14 @@ clean_string(void *cls, | |||
517 | * @return array entry for the result specification to use | 517 | * @return array entry for the result specification to use |
518 | */ | 518 | */ |
519 | struct GNUNET_PQ_ResultSpec | 519 | struct GNUNET_PQ_ResultSpec |
520 | GNUNET_PQ_result_spec_string(const char *name, | 520 | GNUNET_PQ_result_spec_string (const char *name, |
521 | char **dst) | 521 | char **dst) |
522 | { | 522 | { |
523 | struct GNUNET_PQ_ResultSpec res = | 523 | struct GNUNET_PQ_ResultSpec res = |
524 | { &extract_string, | 524 | { &extract_string, |
525 | &clean_string, | 525 | &clean_string, |
526 | NULL, | 526 | NULL, |
527 | (void *)dst, 0, (name), NULL }; | 527 | (void *) dst, 0, (name), NULL }; |
528 | 528 | ||
529 | return res; | 529 | return res; |
530 | } | 530 | } |
@@ -544,53 +544,53 @@ GNUNET_PQ_result_spec_string(const char *name, | |||
544 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) | 544 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) |
545 | */ | 545 | */ |
546 | static int | 546 | static int |
547 | extract_abs_time(void *cls, | 547 | extract_abs_time (void *cls, |
548 | PGresult *result, | 548 | PGresult *result, |
549 | int row, | 549 | int row, |
550 | const char *fname, | 550 | const char *fname, |
551 | size_t *dst_size, | 551 | size_t *dst_size, |
552 | void *dst) | 552 | void *dst) |
553 | { | 553 | { |
554 | struct GNUNET_TIME_Absolute *udst = dst; | 554 | struct GNUNET_TIME_Absolute *udst = dst; |
555 | const int64_t *res; | 555 | const int64_t *res; |
556 | int fnum; | 556 | int fnum; |
557 | 557 | ||
558 | (void)cls; | 558 | (void) cls; |
559 | fnum = PQfnumber(result, | 559 | fnum = PQfnumber (result, |
560 | fname); | 560 | fname); |
561 | if (fnum < 0) | 561 | if (fnum < 0) |
562 | { | 562 | { |
563 | GNUNET_break(0); | 563 | GNUNET_break (0); |
564 | return GNUNET_SYSERR; | 564 | return GNUNET_SYSERR; |
565 | } | 565 | } |
566 | if (PQgetisnull(result, | 566 | if (PQgetisnull (result, |
567 | row, | 567 | row, |
568 | fnum)) | 568 | fnum)) |
569 | { | 569 | { |
570 | GNUNET_break(0); | 570 | GNUNET_break (0); |
571 | return GNUNET_SYSERR; | 571 | return GNUNET_SYSERR; |
572 | } | 572 | } |
573 | GNUNET_assert(NULL != dst); | 573 | GNUNET_assert (NULL != dst); |
574 | if (sizeof(struct GNUNET_TIME_Absolute) != *dst_size) | 574 | if (sizeof(struct GNUNET_TIME_Absolute) != *dst_size) |
575 | { | 575 | { |
576 | GNUNET_break(0); | 576 | GNUNET_break (0); |
577 | return GNUNET_SYSERR; | 577 | return GNUNET_SYSERR; |
578 | } | 578 | } |
579 | if (sizeof(int64_t) != | 579 | if (sizeof(int64_t) != |
580 | PQgetlength(result, | 580 | PQgetlength (result, |
581 | row, | 581 | row, |
582 | fnum)) | 582 | fnum)) |
583 | { | 583 | { |
584 | GNUNET_break(0); | 584 | GNUNET_break (0); |
585 | return GNUNET_SYSERR; | 585 | return GNUNET_SYSERR; |
586 | } | 586 | } |
587 | res = (int64_t *)PQgetvalue(result, | 587 | res = (int64_t *) PQgetvalue (result, |
588 | row, | 588 | row, |
589 | fnum); | 589 | fnum); |
590 | if (INT64_MAX == *res) | 590 | if (INT64_MAX == *res) |
591 | *udst = GNUNET_TIME_UNIT_FOREVER_ABS; | 591 | *udst = GNUNET_TIME_UNIT_FOREVER_ABS; |
592 | else | 592 | else |
593 | udst->abs_value_us = GNUNET_ntohll((uint64_t)*res); | 593 | udst->abs_value_us = GNUNET_ntohll ((uint64_t) *res); |
594 | return GNUNET_OK; | 594 | return GNUNET_OK; |
595 | } | 595 | } |
596 | 596 | ||
@@ -603,14 +603,14 @@ extract_abs_time(void *cls, | |||
603 | * @return array entry for the result specification to use | 603 | * @return array entry for the result specification to use |
604 | */ | 604 | */ |
605 | struct GNUNET_PQ_ResultSpec | 605 | struct GNUNET_PQ_ResultSpec |
606 | GNUNET_PQ_result_spec_absolute_time(const char *name, | 606 | GNUNET_PQ_result_spec_absolute_time (const char *name, |
607 | struct GNUNET_TIME_Absolute *at) | 607 | struct GNUNET_TIME_Absolute *at) |
608 | { | 608 | { |
609 | struct GNUNET_PQ_ResultSpec res = | 609 | struct GNUNET_PQ_ResultSpec res = |
610 | { &extract_abs_time, | 610 | { &extract_abs_time, |
611 | NULL, | 611 | NULL, |
612 | NULL, | 612 | NULL, |
613 | (void *)at, sizeof(*at), (name), NULL }; | 613 | (void *) at, sizeof(*at), (name), NULL }; |
614 | 614 | ||
615 | return res; | 615 | return res; |
616 | } | 616 | } |
@@ -624,11 +624,11 @@ GNUNET_PQ_result_spec_absolute_time(const char *name, | |||
624 | * @return array entry for the result specification to use | 624 | * @return array entry for the result specification to use |
625 | */ | 625 | */ |
626 | struct GNUNET_PQ_ResultSpec | 626 | struct GNUNET_PQ_ResultSpec |
627 | GNUNET_PQ_result_spec_absolute_time_nbo(const char *name, | 627 | GNUNET_PQ_result_spec_absolute_time_nbo (const char *name, |
628 | struct GNUNET_TIME_AbsoluteNBO *at) | 628 | struct GNUNET_TIME_AbsoluteNBO *at) |
629 | { | 629 | { |
630 | struct GNUNET_PQ_ResultSpec res = | 630 | struct GNUNET_PQ_ResultSpec res = |
631 | GNUNET_PQ_result_spec_auto_from_type(name, &at->abs_value_us__); | 631 | GNUNET_PQ_result_spec_auto_from_type (name, &at->abs_value_us__); |
632 | 632 | ||
633 | return res; | 633 | return res; |
634 | } | 634 | } |
@@ -648,50 +648,50 @@ GNUNET_PQ_result_spec_absolute_time_nbo(const char *name, | |||
648 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) | 648 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) |
649 | */ | 649 | */ |
650 | static int | 650 | static int |
651 | extract_uint16(void *cls, | 651 | extract_uint16 (void *cls, |
652 | PGresult *result, | 652 | PGresult *result, |
653 | int row, | 653 | int row, |
654 | const char *fname, | 654 | const char *fname, |
655 | size_t *dst_size, | 655 | size_t *dst_size, |
656 | void *dst) | 656 | void *dst) |
657 | { | 657 | { |
658 | uint16_t *udst = dst; | 658 | uint16_t *udst = dst; |
659 | const uint16_t *res; | 659 | const uint16_t *res; |
660 | int fnum; | 660 | int fnum; |
661 | 661 | ||
662 | (void)cls; | 662 | (void) cls; |
663 | fnum = PQfnumber(result, | 663 | fnum = PQfnumber (result, |
664 | fname); | 664 | fname); |
665 | if (fnum < 0) | 665 | if (fnum < 0) |
666 | { | 666 | { |
667 | GNUNET_break(0); | 667 | GNUNET_break (0); |
668 | return GNUNET_SYSERR; | 668 | return GNUNET_SYSERR; |
669 | } | 669 | } |
670 | if (PQgetisnull(result, | 670 | if (PQgetisnull (result, |
671 | row, | 671 | row, |
672 | fnum)) | 672 | fnum)) |
673 | { | 673 | { |
674 | GNUNET_break(0); | 674 | GNUNET_break (0); |
675 | return GNUNET_SYSERR; | 675 | return GNUNET_SYSERR; |
676 | } | 676 | } |
677 | GNUNET_assert(NULL != dst); | 677 | GNUNET_assert (NULL != dst); |
678 | if (sizeof(uint16_t) != *dst_size) | 678 | if (sizeof(uint16_t) != *dst_size) |
679 | { | 679 | { |
680 | GNUNET_break(0); | 680 | GNUNET_break (0); |
681 | return GNUNET_SYSERR; | 681 | return GNUNET_SYSERR; |
682 | } | 682 | } |
683 | if (sizeof(uint16_t) != | 683 | if (sizeof(uint16_t) != |
684 | PQgetlength(result, | 684 | PQgetlength (result, |
685 | row, | 685 | row, |
686 | fnum)) | 686 | fnum)) |
687 | { | 687 | { |
688 | GNUNET_break(0); | 688 | GNUNET_break (0); |
689 | return GNUNET_SYSERR; | 689 | return GNUNET_SYSERR; |
690 | } | 690 | } |
691 | res = (uint16_t *)PQgetvalue(result, | 691 | res = (uint16_t *) PQgetvalue (result, |
692 | row, | 692 | row, |
693 | fnum); | 693 | fnum); |
694 | *udst = ntohs(*res); | 694 | *udst = ntohs (*res); |
695 | return GNUNET_OK; | 695 | return GNUNET_OK; |
696 | } | 696 | } |
697 | 697 | ||
@@ -704,14 +704,14 @@ extract_uint16(void *cls, | |||
704 | * @return array entry for the result specification to use | 704 | * @return array entry for the result specification to use |
705 | */ | 705 | */ |
706 | struct GNUNET_PQ_ResultSpec | 706 | struct GNUNET_PQ_ResultSpec |
707 | GNUNET_PQ_result_spec_uint16(const char *name, | 707 | GNUNET_PQ_result_spec_uint16 (const char *name, |
708 | uint16_t *u16) | 708 | uint16_t *u16) |
709 | { | 709 | { |
710 | struct GNUNET_PQ_ResultSpec res = | 710 | struct GNUNET_PQ_ResultSpec res = |
711 | { &extract_uint16, | 711 | { &extract_uint16, |
712 | NULL, | 712 | NULL, |
713 | NULL, | 713 | NULL, |
714 | (void *)u16, sizeof(*u16), (name), NULL }; | 714 | (void *) u16, sizeof(*u16), (name), NULL }; |
715 | 715 | ||
716 | return res; | 716 | return res; |
717 | } | 717 | } |
@@ -731,50 +731,50 @@ GNUNET_PQ_result_spec_uint16(const char *name, | |||
731 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) | 731 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) |
732 | */ | 732 | */ |
733 | static int | 733 | static int |
734 | extract_uint32(void *cls, | 734 | extract_uint32 (void *cls, |
735 | PGresult *result, | 735 | PGresult *result, |
736 | int row, | 736 | int row, |
737 | const char *fname, | 737 | const char *fname, |
738 | size_t *dst_size, | 738 | size_t *dst_size, |
739 | void *dst) | 739 | void *dst) |
740 | { | 740 | { |
741 | uint32_t *udst = dst; | 741 | uint32_t *udst = dst; |
742 | const uint32_t *res; | 742 | const uint32_t *res; |
743 | int fnum; | 743 | int fnum; |
744 | 744 | ||
745 | (void)cls; | 745 | (void) cls; |
746 | fnum = PQfnumber(result, | 746 | fnum = PQfnumber (result, |
747 | fname); | 747 | fname); |
748 | if (fnum < 0) | 748 | if (fnum < 0) |
749 | { | 749 | { |
750 | GNUNET_break(0); | 750 | GNUNET_break (0); |
751 | return GNUNET_SYSERR; | 751 | return GNUNET_SYSERR; |
752 | } | 752 | } |
753 | if (PQgetisnull(result, | 753 | if (PQgetisnull (result, |
754 | row, | 754 | row, |
755 | fnum)) | 755 | fnum)) |
756 | { | 756 | { |
757 | GNUNET_break(0); | 757 | GNUNET_break (0); |
758 | return GNUNET_SYSERR; | 758 | return GNUNET_SYSERR; |
759 | } | 759 | } |
760 | GNUNET_assert(NULL != dst); | 760 | GNUNET_assert (NULL != dst); |
761 | if (sizeof(uint32_t) != *dst_size) | 761 | if (sizeof(uint32_t) != *dst_size) |
762 | { | 762 | { |
763 | GNUNET_break(0); | 763 | GNUNET_break (0); |
764 | return GNUNET_SYSERR; | 764 | return GNUNET_SYSERR; |
765 | } | 765 | } |
766 | if (sizeof(uint32_t) != | 766 | if (sizeof(uint32_t) != |
767 | PQgetlength(result, | 767 | PQgetlength (result, |
768 | row, | 768 | row, |
769 | fnum)) | 769 | fnum)) |
770 | { | 770 | { |
771 | GNUNET_break(0); | 771 | GNUNET_break (0); |
772 | return GNUNET_SYSERR; | 772 | return GNUNET_SYSERR; |
773 | } | 773 | } |
774 | res = (uint32_t *)PQgetvalue(result, | 774 | res = (uint32_t *) PQgetvalue (result, |
775 | row, | 775 | row, |
776 | fnum); | 776 | fnum); |
777 | *udst = ntohl(*res); | 777 | *udst = ntohl (*res); |
778 | return GNUNET_OK; | 778 | return GNUNET_OK; |
779 | } | 779 | } |
780 | 780 | ||
@@ -787,14 +787,14 @@ extract_uint32(void *cls, | |||
787 | * @return array entry for the result specification to use | 787 | * @return array entry for the result specification to use |
788 | */ | 788 | */ |
789 | struct GNUNET_PQ_ResultSpec | 789 | struct GNUNET_PQ_ResultSpec |
790 | GNUNET_PQ_result_spec_uint32(const char *name, | 790 | GNUNET_PQ_result_spec_uint32 (const char *name, |
791 | uint32_t *u32) | 791 | uint32_t *u32) |
792 | { | 792 | { |
793 | struct GNUNET_PQ_ResultSpec res = | 793 | struct GNUNET_PQ_ResultSpec res = |
794 | { &extract_uint32, | 794 | { &extract_uint32, |
795 | NULL, | 795 | NULL, |
796 | NULL, | 796 | NULL, |
797 | (void *)u32, sizeof(*u32), (name), NULL }; | 797 | (void *) u32, sizeof(*u32), (name), NULL }; |
798 | 798 | ||
799 | return res; | 799 | return res; |
800 | } | 800 | } |
@@ -814,50 +814,50 @@ GNUNET_PQ_result_spec_uint32(const char *name, | |||
814 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) | 814 | * #GNUNET_SYSERR if a result was invalid (non-existing field or NULL) |
815 | */ | 815 | */ |
816 | static int | 816 | static int |
817 | extract_uint64(void *cls, | 817 | extract_uint64 (void *cls, |
818 | PGresult *result, | 818 | PGresult *result, |
819 | int row, | 819 | int row, |
820 | const char *fname, | 820 | const char *fname, |
821 | size_t *dst_size, | 821 | size_t *dst_size, |
822 | void *dst) | 822 | void *dst) |
823 | { | 823 | { |
824 | uint64_t *udst = dst; | 824 | uint64_t *udst = dst; |
825 | const uint64_t *res; | 825 | const uint64_t *res; |
826 | int fnum; | 826 | int fnum; |
827 | 827 | ||
828 | (void)cls; | 828 | (void) cls; |
829 | fnum = PQfnumber(result, | 829 | fnum = PQfnumber (result, |
830 | fname); | 830 | fname); |
831 | if (fnum < 0) | 831 | if (fnum < 0) |
832 | { | 832 | { |
833 | GNUNET_break(0); | 833 | GNUNET_break (0); |
834 | return GNUNET_SYSERR; | 834 | return GNUNET_SYSERR; |
835 | } | 835 | } |
836 | if (PQgetisnull(result, | 836 | if (PQgetisnull (result, |
837 | row, | 837 | row, |
838 | fnum)) | 838 | fnum)) |
839 | { | 839 | { |
840 | GNUNET_break(0); | 840 | GNUNET_break (0); |
841 | return GNUNET_SYSERR; | 841 | return GNUNET_SYSERR; |
842 | } | 842 | } |
843 | GNUNET_assert(NULL != dst); | 843 | GNUNET_assert (NULL != dst); |
844 | if (sizeof(uint64_t) != *dst_size) | 844 | if (sizeof(uint64_t) != *dst_size) |
845 | { | 845 | { |
846 | GNUNET_break(0); | 846 | GNUNET_break (0); |
847 | return GNUNET_SYSERR; | 847 | return GNUNET_SYSERR; |
848 | } | 848 | } |
849 | if (sizeof(uint64_t) != | 849 | if (sizeof(uint64_t) != |
850 | PQgetlength(result, | 850 | PQgetlength (result, |
851 | row, | 851 | row, |
852 | fnum)) | 852 | fnum)) |
853 | { | 853 | { |
854 | GNUNET_break(0); | 854 | GNUNET_break (0); |
855 | return GNUNET_SYSERR; | 855 | return GNUNET_SYSERR; |
856 | } | 856 | } |
857 | res = (uint64_t *)PQgetvalue(result, | 857 | res = (uint64_t *) PQgetvalue (result, |
858 | row, | 858 | row, |
859 | fnum); | 859 | fnum); |
860 | *udst = GNUNET_ntohll(*res); | 860 | *udst = GNUNET_ntohll (*res); |
861 | return GNUNET_OK; | 861 | return GNUNET_OK; |
862 | } | 862 | } |
863 | 863 | ||
@@ -870,14 +870,14 @@ extract_uint64(void *cls, | |||
870 | * @return array entry for the result specification to use | 870 | * @return array entry for the result specification to use |
871 | */ | 871 | */ |
872 | struct GNUNET_PQ_ResultSpec | 872 | struct GNUNET_PQ_ResultSpec |
873 | GNUNET_PQ_result_spec_uint64(const char *name, | 873 | GNUNET_PQ_result_spec_uint64 (const char *name, |
874 | uint64_t *u64) | 874 | uint64_t *u64) |
875 | { | 875 | { |
876 | struct GNUNET_PQ_ResultSpec res = | 876 | struct GNUNET_PQ_ResultSpec res = |
877 | { &extract_uint64, | 877 | { &extract_uint64, |
878 | NULL, | 878 | NULL, |
879 | NULL, | 879 | NULL, |
880 | (void *)u64, sizeof(*u64), (name), NULL }; | 880 | (void *) u64, sizeof(*u64), (name), NULL }; |
881 | 881 | ||
882 | return res; | 882 | return res; |
883 | } | 883 | } |