gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-twister] 18/34: avoid duplicating tokenized string.


From: gnunet
Subject: [GNUnet-SVN] [taler-twister] 18/34: avoid duplicating tokenized string.
Date: Sat, 17 Mar 2018 01:58:09 +0100

This is an automated email from the git hooks/post-receive script.

marcello pushed a commit to branch master
in repository twister.

commit 63c64f0bd49165cebc77a15aafb836e396ac789a
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu Mar 8 17:06:46 2018 +0100

    avoid duplicating tokenized string.
---
 src/twister/taler-twister-service.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/src/twister/taler-twister-service.c 
b/src/twister/taler-twister-service.c
index f4db07c..ae3d3d0 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -810,7 +810,10 @@ con_val_iter (void *cls,
 
 /**
  * Delete object within the proxied response.
- * Always queues a response
+ * Always queues a response; only deletes the object if it is
+ * found within the response, otherwise return it verbatim (but
+ * will look for it into the next response).  Will flush the
+ * operation once the wanted object has been found.
  *
  * @return MHD_YES / MHD_NO depending on successful / failing
  * response queueing.
@@ -823,7 +826,6 @@ delete_object (struct MHD_Connection *con,
   json_t *element;
   json_t *cur;
   json_error_t error;
-  char *delete_path_dup;
   char *token;
   char *last_token;
   char *mod_body;
@@ -838,15 +840,9 @@ delete_object (struct MHD_Connection *con,
                                hr->response);
   }
 
-  /* unstable if not dup'd. XXX: to be tested again without.
-   * To be freed. */
-  delete_path_dup = GNUNET_strdup (delete_path);
+  last_token = strrchr (delete_path, '.') + 1;
   /* Give first nondelim char. */
-  last_token = strrchr (delete_path_dup, '.') + 1;
-  TALER_LOG_DEBUG ("Last token: address@hidden",
-                   last_token,
-                   last_token);
-  token = strtok (delete_path_dup, ".");
+  token = strtok (delete_path, ".");
   element = parsed_response;
   do
   {
@@ -1194,13 +1190,8 @@ create_response (void *cls,
     hack_response_code = 0; /* reset for next request */
   }
 
-  /* Empty the object pointed by `delete_path` ONLY IF
-     it is found within this response, otherwise it leaves
-     the response untouched. */
   if ('\0' != delete_path[0])
-  {
     return delete_object (con, hr);
-  }
 
   /* response might have been modified. */
   return MHD_queue_response (con,
@@ -1209,7 +1200,7 @@ create_response (void *cls,
 }
 
 
-/* ******************** MHD HTTP setup and event loop ******************** */
+/* ************ MHD HTTP setup and event loop *************** */
 
 
 /**

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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