diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-06-13 15:26:59 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-06-13 15:26:59 +0000 |
commit | 11d9f1f3b73a9eaa8ddf9a52e3029956d77fbf23 (patch) | |
tree | ef6c8643d70ac3d247b8cde9b74882594b11e823 /src/fs/fs_namespace.c | |
parent | e05cff45c3a0cc64197962ade380ac57093b6623 (diff) | |
download | gnunet-11d9f1f3b73a9eaa8ddf9a52e3029956d77fbf23.tar.gz gnunet-11d9f1f3b73a9eaa8ddf9a52e3029956d77fbf23.zip |
-cleanup
Diffstat (limited to 'src/fs/fs_namespace.c')
-rw-r--r-- | src/fs/fs_namespace.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index 4f58b7d5b..c88dbb591 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c | |||
@@ -106,7 +106,7 @@ write_update_information_graph (struct GNUNET_FS_Namespace *ns) | |||
106 | 106 | ||
107 | fn = get_update_information_directory (ns); | 107 | fn = get_update_information_directory (ns); |
108 | wh = GNUNET_BIO_write_open (fn); | 108 | wh = GNUNET_BIO_write_open (fn); |
109 | if (wh == NULL) | 109 | if (NULL == wh) |
110 | { | 110 | { |
111 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 111 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
112 | _("Failed to open `%s' for writing: %s\n"), STRERROR (errno)); | 112 | _("Failed to open `%s' for writing: %s\n"), STRERROR (errno)); |
@@ -160,7 +160,7 @@ read_update_information_graph (struct GNUNET_FS_Namespace *ns) | |||
160 | return; | 160 | return; |
161 | } | 161 | } |
162 | rh = GNUNET_BIO_read_open (fn); | 162 | rh = GNUNET_BIO_read_open (fn); |
163 | if (rh == NULL) | 163 | if (NULL == rh) |
164 | { | 164 | { |
165 | GNUNET_free (fn); | 165 | GNUNET_free (fn); |
166 | return; | 166 | return; |
@@ -175,7 +175,7 @@ read_update_information_graph (struct GNUNET_FS_Namespace *ns) | |||
175 | GNUNET_break (0); | 175 | GNUNET_break (0); |
176 | goto END; | 176 | goto END; |
177 | } | 177 | } |
178 | if (count == 0) | 178 | if (0 == count) |
179 | { | 179 | { |
180 | GNUNET_break (GNUNET_OK == GNUNET_BIO_read_close (rh, NULL)); | 180 | GNUNET_break (GNUNET_OK == GNUNET_BIO_read_close (rh, NULL)); |
181 | GNUNET_free (fn); | 181 | GNUNET_free (fn); |
@@ -226,8 +226,6 @@ END: | |||
226 | } | 226 | } |
227 | 227 | ||
228 | 228 | ||
229 | |||
230 | |||
231 | /** | 229 | /** |
232 | * Create a namespace with the given name; if one already | 230 | * Create a namespace with the given name; if one already |
233 | * exists, return a handle to the existing namespace. | 231 | * exists, return a handle to the existing namespace. |
@@ -250,7 +248,7 @@ GNUNET_FS_namespace_create (struct GNUNET_FS_Handle *h, const char *name) | |||
250 | ret->h = h; | 248 | ret->h = h; |
251 | ret->rc = 1; | 249 | ret->rc = 1; |
252 | ret->key = GNUNET_CRYPTO_rsa_key_create_from_file (fn); | 250 | ret->key = GNUNET_CRYPTO_rsa_key_create_from_file (fn); |
253 | if (ret->key == NULL) | 251 | if (NULL == ret->key) |
254 | { | 252 | { |
255 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 253 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
256 | _("Failed to create or read private key for namespace `%s'\n"), | 254 | _("Failed to create or read private key for namespace `%s'\n"), |
@@ -364,7 +362,7 @@ process_namespace (void *cls, const char *filename) | |||
364 | const char *t; | 362 | const char *t; |
365 | 363 | ||
366 | key = GNUNET_CRYPTO_rsa_key_create_from_file (filename); | 364 | key = GNUNET_CRYPTO_rsa_key_create_from_file (filename); |
367 | if (key == NULL) | 365 | if (NULL == key) |
368 | { | 366 | { |
369 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 367 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
370 | _ | 368 | _ |
@@ -402,7 +400,7 @@ GNUNET_FS_namespace_list (struct GNUNET_FS_Handle *h, | |||
402 | struct ProcessNamespaceContext ctx; | 400 | struct ProcessNamespaceContext ctx; |
403 | 401 | ||
404 | dn = get_namespace_directory (h); | 402 | dn = get_namespace_directory (h); |
405 | if (dn == NULL) | 403 | if (NULL == dn) |
406 | return; | 404 | return; |
407 | ctx.cb = cb; | 405 | ctx.cb = cb; |
408 | ctx.cb_cls = cb_cls; | 406 | ctx.cb_cls = cb_cls; |
@@ -555,7 +553,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
555 | uris = GNUNET_FS_uri_to_string (uri); | 553 | uris = GNUNET_FS_uri_to_string (uri); |
556 | slen = strlen (uris) + 1; | 554 | slen = strlen (uris) + 1; |
557 | idlen = strlen (identifier); | 555 | idlen = strlen (identifier); |
558 | if (update != NULL) | 556 | if (NULL != update) |
559 | nidlen = strlen (update) + 1; | 557 | nidlen = strlen (update) + 1; |
560 | else | 558 | else |
561 | nidlen = 1; | 559 | nidlen = 1; |
@@ -580,7 +578,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
580 | GNUNET_CONTAINER_meta_data_serialize (mmeta, &dest, mdsize, | 578 | GNUNET_CONTAINER_meta_data_serialize (mmeta, &dest, mdsize, |
581 | GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); | 579 | GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); |
582 | GNUNET_CONTAINER_meta_data_destroy (mmeta); | 580 | GNUNET_CONTAINER_meta_data_destroy (mmeta); |
583 | if (mdsize == -1) | 581 | if (-1 == mdsize) |
584 | { | 582 | { |
585 | GNUNET_break (0); | 583 | GNUNET_break (0); |
586 | GNUNET_free (sb); | 584 | GNUNET_free (sb); |
@@ -782,7 +780,7 @@ find_trees (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
782 | 780 | ||
783 | if (nsn->nug == fc->nug) | 781 | if (nsn->nug == fc->nug) |
784 | { | 782 | { |
785 | if (nsn->tree_id == UINT_MAX) | 783 | if (UINT_MAX == nsn->tree_id) |
786 | return GNUNET_YES; /* circular */ | 784 | return GNUNET_YES; /* circular */ |
787 | GNUNET_assert (nsn->tree_id < fc->tree_array_size); | 785 | GNUNET_assert (nsn->tree_id < fc->tree_array_size); |
788 | if (fc->tree_array[nsn->tree_id] != nsn) | 786 | if (fc->tree_array[nsn->tree_id] != nsn) |
@@ -792,7 +790,7 @@ find_trees (void *cls, const struct GNUNET_HashCode * key, void *value) | |||
792 | return GNUNET_YES; /* that's our own root (can this be?) */ | 790 | return GNUNET_YES; /* that's our own root (can this be?) */ |
793 | /* merge existing TREE, we have a root for both */ | 791 | /* merge existing TREE, we have a root for both */ |
794 | fc->tree_array[nsn->tree_id] = NULL; | 792 | fc->tree_array[nsn->tree_id] = NULL; |
795 | if (fc->id == UINT_MAX) | 793 | if (UINT_MAX == fc->id) |
796 | fc->id = nsn->tree_id; /* take over ID */ | 794 | fc->id = nsn->tree_id; /* take over ID */ |
797 | } | 795 | } |
798 | else | 796 | else |
@@ -843,15 +841,15 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
843 | struct ProcessUpdateClosure pc; | 841 | struct ProcessUpdateClosure pc; |
844 | struct FindTreeClosure fc; | 842 | struct FindTreeClosure fc; |
845 | 843 | ||
846 | if (namespace->update_nodes == NULL) | 844 | if (NULL == namespace->update_nodes) |
847 | read_update_information_graph (namespace); | 845 | read_update_information_graph (namespace); |
848 | if (namespace->update_nodes == NULL) | 846 | if (NULL == namespace->update_nodes) |
849 | { | 847 | { |
850 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 848 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
851 | "No updateable nodes found for ID `%s'\n", next_id); | 849 | "No updateable nodes found for ID `%s'\n", next_id); |
852 | return; /* no nodes */ | 850 | return; /* no nodes */ |
853 | } | 851 | } |
854 | if (namespace->update_map == NULL) | 852 | if (NULL == namespace->update_map) |
855 | { | 853 | { |
856 | /* need to construct */ | 854 | /* need to construct */ |
857 | namespace->update_map = | 855 | namespace->update_map = |
@@ -866,7 +864,7 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
866 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); | 864 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); |
867 | } | 865 | } |
868 | } | 866 | } |
869 | if (next_id != NULL) | 867 | if (NULL != next_id) |
870 | { | 868 | { |
871 | GNUNET_CRYPTO_hash (next_id, strlen (next_id), &hc); | 869 | GNUNET_CRYPTO_hash (next_id, strlen (next_id), &hc); |
872 | pc.ip = ip; | 870 | pc.ip = ip; |
@@ -899,7 +897,7 @@ GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Namespace *namespace, | |||
899 | fc.namespace = namespace; | 897 | fc.namespace = namespace; |
900 | GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, &hc, | 898 | GNUNET_CONTAINER_multihashmap_get_multiple (namespace->update_map, &hc, |
901 | &find_trees, &fc); | 899 | &find_trees, &fc); |
902 | if (fc.id == UINT_MAX) | 900 | if (UINT_MAX == fc.id) |
903 | { | 901 | { |
904 | /* start new TREE */ | 902 | /* start new TREE */ |
905 | for (fc.id = 0; fc.id < fc.tree_array_size; fc.id++) | 903 | for (fc.id = 0; fc.id < fc.tree_array_size; fc.id++) |