commit c171a099e07baa1afcaf8f6a5030a8b8be8886a5
parent b0b190fb57a4bb5eb4f9c5b1da6a4311496112e1
Author: Schanzenbach, Martin <mschanzenbach@posteo.de>
Date: Tue, 30 Apr 2019 17:57:20 +0200
REST: ftbfs
Diffstat:
1 file changed, 6 insertions(+), 19 deletions(-)
diff --git 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;i<rd_count;i++)
- {
- if ((rd[i].record_type != handle->record_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);
}