From 632a0bd9d3f244f26c242ee200b0b3a31a7f68df Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 5 Nov 2013 22:19:43 +0000 Subject: -stylistic fixes --- src/fs/fs_api.c | 19 ++++++++++--------- src/fs/fs_download.c | 4 ++-- src/fs/fs_search.c | 44 +++++++++++++++++++++----------------------- 3 files changed, 33 insertions(+), 34 deletions(-) (limited to 'src/fs') diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index 88d82158e..72d5eab15 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c @@ -313,7 +313,7 @@ GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, GNUNET_FS_QueueStart start, { struct GNUNET_FS_QueueEntry *qe; - qe = GNUNET_malloc (sizeof (struct GNUNET_FS_QueueEntry)); + qe = GNUNET_new (struct GNUNET_FS_QueueEntry); qe->h = h; qe->start = start; qe->stop = stop; @@ -2298,7 +2298,7 @@ deserialize_search (struct GNUNET_FS_Handle *h, * * @param cls the 'struct GNUNET_FS_SearchContext*' * @param filename complete filename (absolute path) - * @return GNUNET_OK (continue to iterate) + * @return #GNUNET_OK (continue to iterate) */ static int deserialize_search_result (void *cls, const char *filename) @@ -2332,7 +2332,7 @@ deserialize_search_result (void *cls, const char *filename) uris = NULL; download = NULL; update_srch = NULL; - sr = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchResult)); + sr = GNUNET_new (struct GNUNET_FS_SearchResult); sr->h = sc->h; sr->sc = sc; sr->serialization = ser; @@ -2398,7 +2398,8 @@ deserialize_search_result (void *cls, const char *filename) GNUNET_free (update_srch); } GNUNET_break (GNUNET_YES == - GNUNET_CONTAINER_multihashmap_put (sc->master_result_map, &sr->key, sr, + GNUNET_CONTAINER_multihashmap_put (sc->master_result_map, + &sr->key, sr, GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); if (GNUNET_OK != GNUNET_BIO_read_close (rh, &emsg)) { @@ -2588,7 +2589,7 @@ free_search_context (struct GNUNET_FS_SearchContext *sc) * * @param cls the 'struct GNUNET_FS_DownloadContext*' (parent) * @param filename complete filename (absolute path) - * @return GNUNET_OK (continue to iterate) + * @return #GNUNET_OK (continue to iterate) */ static int deserialize_subdownload (void *cls, const char *filename) @@ -2678,7 +2679,7 @@ deserialize_download (struct GNUNET_FS_Handle *h, uris = NULL; emsg = NULL; - dc = GNUNET_malloc (sizeof (struct GNUNET_FS_DownloadContext)); + dc = GNUNET_new (struct GNUNET_FS_DownloadContext); dc->parent = parent; dc->h = h; dc->serialization = GNUNET_strdup (serialization); @@ -2807,7 +2808,7 @@ deserialize_search (struct GNUNET_FS_Handle *h, } uris = NULL; emsg = NULL; - sc = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchContext)); + sc = GNUNET_new (struct GNUNET_FS_SearchContext); if (NULL != psearch_result) { sc->psearch_result = psearch_result; @@ -2868,7 +2869,7 @@ cleanup: * * @param cls the 'struct GNUNET_FS_Handle*' * @param filename complete filename (absolute path) - * @return GNUNET_OK (continue to iterate) + * @return #GNUNET_OK (continue to iterate) */ static int deserialize_search_file (void *cls, const char *filename) @@ -2919,7 +2920,7 @@ deserialize_search_file (void *cls, const char *filename) * * @param cls the 'struct GNUNET_FS_Handle*' * @param filename complete filename (absolute path) - * @return GNUNET_OK (continue to iterate) + * @return #GNUNET_OK (continue to iterate) */ static int deserialize_download_file (void *cls, const char *filename) diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 070be0106..997d42e18 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -934,7 +934,7 @@ GNUNET_FS_free_download_request_ (struct DownloadRequest *dr) * @param cls closure (our 'struct ProcessResultClosure') * @param key query for the given value / request * @param value value in the hash map (a 'struct DownloadRequest') - * @return GNUNET_YES (we should continue to iterate); unless serious error + * @return #GNUNET_YES (we should continue to iterate); unless serious error */ static int process_result_with_request (void *cls, const struct GNUNET_HashCode * key, @@ -1492,7 +1492,7 @@ activate_fs_download (void *cls, struct GNUNET_CLIENT_Connection *client) /** * We must stop to ask the FS service for our blocks. Pause the download. * - * @param cls the 'struct GNUNET_FS_DownloadContext' + * @param cls the `struct GNUNET_FS_DownloadContext` */ static void deactivate_fs_download (void *cls) diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index fe99a9cf9..52bc4aca0 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c @@ -1326,7 +1326,8 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc) * @return #GNUNET_OK */ static int -search_result_freeze_probes (void *cls, const struct GNUNET_HashCode * key, +search_result_freeze_probes (void *cls, + const struct GNUNET_HashCode *key, void *value) { struct GNUNET_FS_SearchResult *sr = value; @@ -1396,21 +1397,12 @@ search_result_suspend (void *cls, GNUNET_FS_download_signal_suspend_ (sr->download); sr->download = NULL; } - if (NULL != sr->probe_ctx) - { - GNUNET_FS_download_stop (sr->probe_ctx, GNUNET_YES); - sr->probe_ctx = NULL; - } - if (GNUNET_SCHEDULER_NO_TASK != sr->probe_ping_task) - { - GNUNET_SCHEDULER_cancel (sr->probe_ping_task); - sr->probe_ping_task = GNUNET_SCHEDULER_NO_TASK; - } if (NULL != sr->update_search) { GNUNET_FS_search_signal_suspend_ (sr->update_search); sr->update_search = NULL; } + GNUNET_FS_search_stop_probe_ (sr); pi.status = GNUNET_FS_STATUS_SEARCH_RESULT_SUSPEND; pi.value.search.specifics.result_suspend.cctx = sr->client_info; pi.value.search.specifics.result_suspend.meta = sr->meta; @@ -1420,11 +1412,6 @@ search_result_suspend (void *cls, GNUNET_free_non_null (sr->serialization); GNUNET_FS_uri_destroy (sr->uri); GNUNET_CONTAINER_meta_data_destroy (sr->meta); - if (GNUNET_SCHEDULER_NO_TASK != sr->probe_cancel_task) - { - GNUNET_SCHEDULER_cancel (sr->probe_cancel_task); - sr->probe_cancel_task = GNUNET_SCHEDULER_NO_TASK; - } GNUNET_free_non_null (sr->keyword_bitmap); GNUNET_free (sr); return GNUNET_OK; @@ -1435,7 +1422,7 @@ search_result_suspend (void *cls, * Create SUSPEND event for the given search operation * and then clean up our state (without stop signal). * - * @param cls the 'struct GNUNET_FS_SearchContext' to signal for + * @param cls the `struct GNUNET_FS_SearchContext` to signal for */ void GNUNET_FS_search_signal_suspend_ (void *cls) @@ -1451,9 +1438,15 @@ GNUNET_FS_search_signal_suspend_ (void *cls) sc->client_info = GNUNET_FS_search_make_status_ (&pi, sc->h, sc); GNUNET_break (NULL == sc->client_info); if (sc->task != GNUNET_SCHEDULER_NO_TASK) + { GNUNET_SCHEDULER_cancel (sc->task); + sc->task = GNUNET_SCHEDULER_NO_TASK; + } if (NULL != sc->client) + { GNUNET_CLIENT_disconnect (sc->client); + sc->client = NULL; + } GNUNET_CONTAINER_multihashmap_destroy (sc->master_result_map); if (NULL != sc->requests) { @@ -1509,8 +1502,10 @@ GNUNET_FS_search_pause (struct GNUNET_FS_SearchContext *sc) struct GNUNET_FS_ProgressInfo pi; if (GNUNET_SCHEDULER_NO_TASK != sc->task) + { GNUNET_SCHEDULER_cancel (sc->task); - sc->task = GNUNET_SCHEDULER_NO_TASK; + sc->task = GNUNET_SCHEDULER_NO_TASK; + } if (NULL != sc->client) GNUNET_CLIENT_disconnect (sc->client); sc->client = NULL; @@ -1549,17 +1544,18 @@ GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc) * @param cls the global FS handle * @param key the key for the search result (unused) * @param value the search result to free - * @return GNUNET_OK + * @return #GNUNET_OK */ static int -search_result_stop (void *cls, const struct GNUNET_HashCode * key, void *value) +search_result_stop (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_FS_SearchContext *sc = cls; struct GNUNET_FS_SearchResult *sr = value; struct GNUNET_FS_ProgressInfo pi; GNUNET_FS_search_stop_probe_ (sr); - if (NULL != sr->download) { sr->download->search = NULL; @@ -1593,10 +1589,12 @@ search_result_stop (void *cls, const struct GNUNET_HashCode * key, void *value) * @param cls the global FS handle * @param key the key for the search result (unused) * @param value the search result to free - * @return GNUNET_OK + * @return #GNUNET_OK */ static int -search_result_free (void *cls, const struct GNUNET_HashCode * key, void *value) +search_result_free (void *cls, + const struct GNUNET_HashCode *key, + void *value) { struct GNUNET_FS_SearchResult *sr = value; -- cgit v1.2.3