summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/taler_mhd_lib.h12
-rw-r--r--src/mhd/mhd_responses.c11
2 files changed, 22 insertions, 1 deletions
diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h
index aba7cd8e2..ba5a072c4 100644
--- a/src/include/taler_mhd_lib.h
+++ b/src/include/taler_mhd_lib.h
@@ -212,6 +212,16 @@ TALER_MHD_make_json (const json_t *json);
/**
+ * Make JSON response object and free @a json.
+ *
+ * @param json the json object, freed.
+ * @return MHD response object
+ */
+struct MHD_Response *
+TALER_MHD_make_json_steal (json_t *json);
+
+
+/**
* Make JSON response object.
*
* @param fmt format string for pack
@@ -230,7 +240,7 @@ TALER_MHD_make_json_pack (const char *fmt,
* @return MHD response object
*/
#define TALER_MHD_MAKE_JSON_PACK(...) \
- TALER_MHD_make_json (GNUNET_JSON_PACK (__VA_ARGS__))
+ TALER_MHD_make_json_steal (GNUNET_JSON_PACK (__VA_ARGS__))
/**
diff --git a/src/mhd/mhd_responses.c b/src/mhd/mhd_responses.c
index b7ff52e66..c993436cd 100644
--- a/src/mhd/mhd_responses.c
+++ b/src/mhd/mhd_responses.c
@@ -148,6 +148,17 @@ TALER_MHD_make_json (const json_t *json)
}
+struct MHD_Response *
+TALER_MHD_make_json_steal (json_t *json)
+{
+ struct MHD_Response *res;
+
+ res = TALER_MHD_make_json (json);
+ json_decref (json);
+ return res;
+}
+
+
MHD_RESULT
TALER_MHD_reply_json (struct MHD_Connection *connection,
const json_t *json,