[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-twister] branch master updated: reuse internal json
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-twister] branch master updated: reuse internal json to encode/decode upload data. |
Date: |
Thu, 17 May 2018 00:50:46 +0200 |
This is an automated email from the git hooks/post-receive script.
marcello pushed a commit to branch master
in repository twister.
The following commit(s) were added to refs/heads/master by this push:
new 88ae598 reuse internal json to encode/decode upload data.
88ae598 is described below
commit 88ae598d1787b54e460dbf00edbe3b9e6df64620
Author: Marcello Stanisci <address@hidden>
AuthorDate: Thu May 17 00:43:37 2018 +0200
reuse internal json to encode/decode upload data.
---
src/twister/taler-twister-service.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/twister/taler-twister-service.c
b/src/twister/taler-twister-service.c
index 1fb27c5..6532cd4 100644
--- a/src/twister/taler-twister-service.c
+++ b/src/twister/taler-twister-service.c
@@ -153,7 +153,7 @@ struct HttpRequest
char *url;
/**
- * Response's JSON.
+ * JSON we use to parse payloads (in both directions).
*/
json_t *json;
@@ -494,6 +494,9 @@ create_mhd_response_from_hr (struct HttpRequest *hr)
(unsigned int) resp_code);
hr->response_code = resp_code;
+
+ /* Note, will be NULL if io_buf does not represent
+ * a JSON value. */
hr->json = json_loadb (hr->io_buf,
hr->io_len,
JSON_DECODE_ANY,
@@ -1252,23 +1255,24 @@ create_response (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Going to modify the upload object (%s)\n",
hr->io_buf);
- json_t *tmp;
- tmp = json_loads (hr->io_buf,
- JSON_REJECT_DUPLICATES,
- NULL);
+
+ hr->json = json_loads (hr->io_buf,
+ JSON_REJECT_DUPLICATES,
+ NULL);
flip_object (con,
- tmp,
+ hr->json,
flip_path_ul);
- json_dumpb (tmp,
+ json_dumpb (hr->json,
hr->io_buf,
- hr->io_len, /* Existing io_len is enough to accomodate this
encoding. */
+/* Existing io_len is enough to accomodate this encoding. */
+ hr->io_len,
JSON_COMPACT);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Flipped (?) upload object (%s)\n",
hr->io_buf);
- json_decref (tmp);
+ json_decref (hr->json);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [taler-twister] branch master updated: reuse internal json to encode/decode upload data.,
gnunet <=