From: Schanzenbach, Martin Date: Tue, 30 Apr 2019 15:57:20 +0000 (+0200) Subject: REST: ftbfs X-Git-Tag: v0.11.4~50 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c171a099e07baa1afcaf8f6a5030a8b8be8886a5;p=oweals%2Fgnunet.git REST: ftbfs --- diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index e41df4085..21638fdf6 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c @@ -100,7 +100,7 @@ struct RequestHandle * Rest connection */ struct GNUNET_REST_RequestHandle *rest_handle; - + /** * Desired timeout for the lookup (default is no timeout). */ @@ -172,7 +172,7 @@ cleanup_handle (void *cls) GNUNET_free (handle->name); if (NULL != handle->emsg) GNUNET_free (handle->emsg); - + GNUNET_free (handle); } @@ -222,8 +222,7 @@ handle_gns_response (void *cls, { struct RequestHandle *handle = cls; struct MHD_Response *resp; - json_t *result_array; - json_t *record_obj; + json_t *result_obj; char *result; handle->gns_lookup = NULL; @@ -236,26 +235,14 @@ handle_gns_response (void *cls, return; } - result_array = json_array(); - for (uint32_t i=0;irecord_type) && - (GNUNET_GNSRECORD_TYPE_ANY != handle->record_type) ) - { - continue; - } - - record_obj = GNUNET_JSON_from_gns_record(NULL,&rd[i]); - json_array_append (result_array, record_obj); - json_decref (record_obj); - } + result_obj = GNUNET_JSON_from_gnsrecord (handle->name, rd, rd_count); - result = json_dumps(result_array, 0); + result = json_dumps(result_obj, 0); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); resp = GNUNET_REST_create_response (result); handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); GNUNET_free (result); - json_decref (result_array); + json_decref (result_obj); GNUNET_SCHEDULER_add_now(&cleanup_handle, handle); }