gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r36362 - in gnunet/src: identity namestore rest


From: gnunet
Subject: [GNUnet-SVN] r36362 - in gnunet/src: identity namestore rest
Date: Tue, 15 Sep 2015 11:05:19 +0200

Author: schanzen
Date: 2015-09-15 11:05:18 +0200 (Tue, 15 Sep 2015)
New Revision: 36362

Modified:
   gnunet/src/identity/plugin_rest_identity.c
   gnunet/src/namestore/plugin_rest_namestore.c
   gnunet/src/rest/rest.c
Log:
- fixes


Modified: gnunet/src/identity/plugin_rest_identity.c
===================================================================
--- gnunet/src/identity/plugin_rest_identity.c  2015-09-14 16:05:31 UTC (rev 
36361)
+++ gnunet/src/identity/plugin_rest_identity.c  2015-09-15 09:05:18 UTC (rev 
36362)
@@ -882,7 +882,6 @@
   handle->identity_handle = GNUNET_IDENTITY_connect (cfg,
                                                      &list_ego,
                                                      handle);
-  GNUNET_strdup ("Timeout");
   handle->timeout_task =
     GNUNET_SCHEDULER_add_delayed (handle->timeout,
                                   &do_error,

Modified: gnunet/src/namestore/plugin_rest_namestore.c
===================================================================
--- gnunet/src/namestore/plugin_rest_namestore.c        2015-09-14 16:05:31 UTC 
(rev 36361)
+++ gnunet/src/namestore/plugin_rest_namestore.c        2015-09-15 09:05:18 UTC 
(rev 36362)
@@ -234,6 +234,8 @@
   int i;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Cleaning up\n");
+  if (NULL != handle->resp_object)
+    GNUNET_REST_jsonapi_object_delete (handle->resp_object);
   if (NULL != handle->name)
     GNUNET_free (handle->name);
   if (NULL != handle->timeout_task)
@@ -384,7 +386,6 @@
       GNUNET_SCHEDULER_add_now (&do_error, handle);
       return;
     }
-    GNUNET_REST_jsonapi_object_delete (handle->resp_object);
     resp = GNUNET_REST_create_json_response (result);
     handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
     GNUNET_free (result);

Modified: gnunet/src/rest/rest.c
===================================================================
--- gnunet/src/rest/rest.c      2015-09-14 16:05:31 UTC (rev 36361)
+++ gnunet/src/rest/rest.c      2015-09-15 09:05:18 UTC (rev 36362)
@@ -407,26 +407,17 @@
     return GNUNET_SYSERR;
 
   root_json = json_object ();
-  if (0 == resp->res_count)
+  res_arr = json_array ();
+  for (res = resp->res_list_head; 
+       res != NULL;
+       res = res->next)
   {
-    json_object_set (root_json, GNUNET_REST_JSONAPI_KEY_DATA, json_array());
+    json_array_append (res_arr, res->res_obj);
   }
-  else if (1 == resp->res_count)
-  {
-    json_object_set (root_json, GNUNET_REST_JSONAPI_KEY_DATA, 
resp->res_list_head->res_obj);
-  }
-  else
-  {
-    res_arr = json_array ();
-    for (res = resp->res_list_head; 
-         res != NULL;
-         res = res->next)
-    {
-      json_array_append (res_arr, res->res_obj);
-    }
-    json_object_set (root_json, GNUNET_REST_JSONAPI_KEY_DATA, res_arr);
-  }
+  json_object_set (root_json, GNUNET_REST_JSONAPI_KEY_DATA, res_arr);
   *result = json_dumps (root_json, JSON_INDENT(2));
+  json_decref (root_json);
+  json_decref (res_arr);
   return GNUNET_OK;
 }
 
@@ -434,13 +425,13 @@
  * REST Utilities
  */
 
-/**
- * Check if namespace is in URL.
- *
- * @param url URL to check
- * @param namespace namespace to check against
- * @retun GNUNET_YES if namespace matches
- */
+  /**
+   * Check if namespace is in URL.
+   *
+   * @param url URL to check
+   * @param namespace namespace to check against
+   * @retun GNUNET_YES if namespace matches
+   */
 int
 GNUNET_REST_namespace_match (const char *url, const char *namespace)
 {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]