diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-08-30 21:42:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-08-30 21:42:10 +0000 |
commit | 4a9e2610bde0a3f3899ec3b114e712c81978e962 (patch) | |
tree | 62a2465d1a8838b9da785ebb85014515efd2287e | |
parent | ffa0156860c584608db5bde1038e127c6e8fda21 (diff) | |
download | gnunet-4a9e2610bde0a3f3899ec3b114e712c81978e962.tar.gz gnunet-4a9e2610bde0a3f3899ec3b114e712c81978e962.zip |
nitpicks
-rw-r--r-- | src/datastore/plugin_datastore_postgres.c | 4 | ||||
-rw-r--r-- | src/fs/test_fs_uri.c | 7 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_learning.c | 44 | ||||
-rw-r--r-- | src/util/test_container_slist.c | 11 |
4 files changed, 31 insertions, 35 deletions
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 54bdde542..a5f4b2c4b 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c | |||
@@ -992,6 +992,7 @@ postgres_iterate (struct Plugin *plugin, | |||
992 | iter (iter_cls, | 992 | iter (iter_cls, |
993 | NULL, NULL, 0, NULL, 0, 0, 0, | 993 | NULL, NULL, 0, NULL, 0, 0, 0, |
994 | GNUNET_TIME_UNIT_ZERO_ABS, 0); | 994 | GNUNET_TIME_UNIT_ZERO_ABS, 0); |
995 | GNUNET_free (nrc); | ||
995 | return; | 996 | return; |
996 | } | 997 | } |
997 | nrc->bnow = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()).value__; | 998 | nrc->bnow = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()).value__; |
@@ -1161,6 +1162,7 @@ postgres_plugin_get (void *cls, | |||
1161 | iter (iter_cls, | 1162 | iter (iter_cls, |
1162 | NULL, NULL, 0, NULL, 0, 0, 0, | 1163 | NULL, NULL, 0, NULL, 0, 0, 0, |
1163 | GNUNET_TIME_UNIT_ZERO_ABS, 0); | 1164 | GNUNET_TIME_UNIT_ZERO_ABS, 0); |
1165 | GNUNET_free (nrc); | ||
1164 | return; | 1166 | return; |
1165 | } | 1167 | } |
1166 | if ((PQntuples (ret) != 1) || | 1168 | if ((PQntuples (ret) != 1) || |
@@ -1172,6 +1174,7 @@ postgres_plugin_get (void *cls, | |||
1172 | iter (iter_cls, | 1174 | iter (iter_cls, |
1173 | NULL, NULL, 0, NULL, 0, 0, 0, | 1175 | NULL, NULL, 0, NULL, 0, 0, 0, |
1174 | GNUNET_TIME_UNIT_ZERO_ABS, 0); | 1176 | GNUNET_TIME_UNIT_ZERO_ABS, 0); |
1177 | GNUNET_free (nrc); | ||
1175 | return; | 1178 | return; |
1176 | } | 1179 | } |
1177 | nrc->total = GNUNET_ntohll (*(const unsigned long long *) PQgetvalue (ret, 0, 0)); | 1180 | nrc->total = GNUNET_ntohll (*(const unsigned long long *) PQgetvalue (ret, 0, 0)); |
@@ -1181,6 +1184,7 @@ postgres_plugin_get (void *cls, | |||
1181 | iter (iter_cls, | 1184 | iter (iter_cls, |
1182 | NULL, NULL, 0, NULL, 0, 0, 0, | 1185 | NULL, NULL, 0, NULL, 0, 0, 0, |
1183 | GNUNET_TIME_UNIT_ZERO_ABS, 0); | 1186 | GNUNET_TIME_UNIT_ZERO_ABS, 0); |
1187 | GNUNET_free (nrc); | ||
1184 | return; | 1188 | return; |
1185 | } | 1189 | } |
1186 | nrc->off = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, | 1190 | nrc->off = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, |
diff --git a/src/fs/test_fs_uri.c b/src/fs/test_fs_uri.c index 56cb7e10d..0131ab32f 100644 --- a/src/fs/test_fs_uri.c +++ b/src/fs/test_fs_uri.c | |||
@@ -38,8 +38,11 @@ testKeyword () | |||
38 | struct GNUNET_FS_Uri *ret; | 38 | struct GNUNET_FS_Uri *ret; |
39 | char *emsg; | 39 | char *emsg; |
40 | 40 | ||
41 | if (NULL != GNUNET_FS_uri_parse ("gnunet://fs/ksk/++", &emsg)) | 41 | if (NULL != (ret = GNUNET_FS_uri_parse ("gnunet://fs/ksk/++", &emsg))) |
42 | ABORT (); | 42 | { |
43 | GNUNET_FS_uri_destroy (ret); | ||
44 | ABORT (); | ||
45 | } | ||
43 | GNUNET_free (emsg); | 46 | GNUNET_free (emsg); |
44 | ret = GNUNET_FS_uri_parse ("gnunet://fs/ksk/foo+bar", &emsg); | 47 | ret = GNUNET_FS_uri_parse ("gnunet://fs/ksk/foo+bar", &emsg); |
45 | if (ret == NULL) | 48 | if (ret == NULL) |
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index d1a04ffe8..4bbbdb4d0 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c | |||
@@ -288,8 +288,7 @@ static int ad_arrive_handler (void *cls, | |||
288 | uint32_t distance) | 288 | uint32_t distance) |
289 | { | 289 | { |
290 | char *hostname; | 290 | char *hostname; |
291 | char *expected_uri = GNUNET_malloc (MAX_URL_LEN); | 291 | char *expected_uri; |
292 | |||
293 | unsigned long long port; | 292 | unsigned long long port; |
294 | size_t size; | 293 | size_t size; |
295 | const struct GNUNET_MessageHeader * incoming; | 294 | const struct GNUNET_MessageHeader * incoming; |
@@ -299,10 +298,9 @@ static int ad_arrive_handler (void *cls, | |||
299 | "HTTPPORT", | 298 | "HTTPPORT", |
300 | &port)) | 299 | &port)) |
301 | { | 300 | { |
302 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 301 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
303 | "Could not read advertising server's configuration\n" ); | 302 | "Could not read advertising server's configuration\n" ); |
304 | if ( NULL != expected_uri ) GNUNET_free ( expected_uri ); | 303 | return GNUNET_SYSERR; |
305 | return GNUNET_SYSERR; | ||
306 | } | 304 | } |
307 | 305 | ||
308 | if ( GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (adv_peer.cfg, | 306 | if ( GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (adv_peer.cfg, |
@@ -311,35 +309,23 @@ static int ad_arrive_handler (void *cls, | |||
311 | &hostname)) | 309 | &hostname)) |
312 | hostname = GNUNET_RESOLVER_local_fqdn_get (); | 310 | hostname = GNUNET_RESOLVER_local_fqdn_get (); |
313 | 311 | ||
314 | if (NULL != hostname) | 312 | GNUNET_asprintf (&expected_uri, |
315 | { | 313 | "http://%s:%u/", |
316 | size = strlen (hostname); | 314 | hostname != NULL ? hostname : "localhost", |
317 | if (size + 15 > MAX_URL_LEN) | 315 | (unsigned int) port); |
318 | { | ||
319 | GNUNET_break (0); | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | GNUNET_asprintf (&expected_uri, | ||
324 | "http://%s:%u/", | ||
325 | hostname, | ||
326 | (unsigned int) port); | ||
327 | } | ||
328 | } | ||
329 | |||
330 | incoming = (const struct GNUNET_MessageHeader *) message; | 316 | incoming = (const struct GNUNET_MessageHeader *) message; |
331 | current_adv_uri = strdup ((char*) &incoming[1]); | 317 | current_adv_uri = strdup ((char*) &incoming[1]); |
332 | if ( 0 == strcmp( expected_uri, current_adv_uri ) ) | 318 | if ( 0 == strcmp( expected_uri, current_adv_uri ) ) |
333 | { | 319 | { |
334 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 320 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
335 | "Recieved hostlist advertisement with URI `%s' as expected\n", current_adv_uri); | 321 | "Recieved hostlist advertisement with URI `%s' as expected\n", current_adv_uri); |
336 | adv_arrived = GNUNET_YES; | 322 | adv_arrived = GNUNET_YES; |
337 | adv_sent = GNUNET_YES; | 323 | adv_sent = GNUNET_YES; |
338 | } | 324 | } |
339 | else | 325 | else |
340 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 326 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
341 | "Expected URI `%s' and recieved URI `%s' differ\n", expected_uri, current_adv_uri); | 327 | "Expected URI `%s' and recieved URI `%s' differ\n", expected_uri, current_adv_uri); |
342 | GNUNET_free_non_null (expected_uri); | 328 | GNUNET_free (expected_uri); |
343 | GNUNET_free_non_null (hostname); | 329 | GNUNET_free_non_null (hostname); |
344 | return GNUNET_OK; | 330 | return GNUNET_OK; |
345 | } | 331 | } |
diff --git a/src/util/test_container_slist.c b/src/util/test_container_slist.c index a9523c9d2..af3c3f39a 100644 --- a/src/util/test_container_slist.c +++ b/src/util/test_container_slist.c | |||
@@ -58,11 +58,14 @@ main (int argc, char *argv[]) | |||
58 | GNUNET_CONTAINER_slist_next (it), i--) | 58 | GNUNET_CONTAINER_slist_next (it), i--) |
59 | { | 59 | { |
60 | p = GNUNET_CONTAINER_slist_get (it, &s); | 60 | p = GNUNET_CONTAINER_slist_get (it, &s); |
61 | CHECK (p != NULL); | ||
62 | j = *(int *) p; | ||
63 | CHECK (i == j); | ||
64 | CHECK (s == sizeof (i)); | ||
65 | 61 | ||
62 | if ( (p == NULL) || | ||
63 | (i != (j = *(int *) p)) || | ||
64 | (s != sizeof (i)) ) | ||
65 | { | ||
66 | GNUNET_CONTAINER_slist_iter_destroy (it); | ||
67 | CHECK (0); | ||
68 | } | ||
66 | j *= 2; | 69 | j *= 2; |
67 | GNUNET_CONTAINER_slist_insert (it, | 70 | GNUNET_CONTAINER_slist_insert (it, |
68 | GNUNET_CONTAINER_SLIST_DISPOSITION_TRANSIENT, | 71 | GNUNET_CONTAINER_SLIST_DISPOSITION_TRANSIENT, |