summaryrefslogtreecommitdiff
path: root/src/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/json.c')
-rw-r--r--src/json.c45
1 files changed, 22 insertions, 23 deletions
diff --git a/src/json.c b/src/json.c
index 71ae0e4..806ab3e 100644
--- a/src/json.c
+++ b/src/json.c
@@ -44,8 +44,7 @@ gchar *trg_serialize(JsonNode * req)
return response;
}
-JsonObject *trg_deserialize(trg_response * response,
- GError ** error)
+JsonObject *trg_deserialize(trg_response * response, GError ** error)
{
JsonParser *parser;
JsonNode *root;
@@ -53,30 +52,30 @@ JsonObject *trg_deserialize(trg_response * response,
parser = json_parser_new();
json_parser_load_from_data(parser, response->raw, response->size,
- error);
+ error);
if (*error == NULL) {
- root = json_parser_get_root(parser);
+ root = json_parser_get_root(parser);
#ifdef DEBUG
- if (g_getenv("TRG_SHOW_INCOMING") != NULL) {
- g_debug("<=(INcoming)<=: %s", response->raw);
- } else if (g_getenv("TRG_SHOW_INCOMING_PRETTY") != NULL) {
- JsonGenerator *pg;
- gsize len;
- gchar *pgdata;
-
- pg = json_generator_new();
- g_object_set(pg, "pretty", TRUE, NULL);
- json_generator_set_root(pg, root);
-
- pgdata = json_generator_to_data(pg, &len);
- g_debug("<=(incoming)<=:\n%s\n", pgdata);
- g_free(pgdata);
-
- g_object_unref(pg);
- }
+ if (g_getenv("TRG_SHOW_INCOMING") != NULL) {
+ g_debug("<=(INcoming)<=: %s", response->raw);
+ } else if (g_getenv("TRG_SHOW_INCOMING_PRETTY") != NULL) {
+ JsonGenerator *pg;
+ gsize len;
+ gchar *pgdata;
+
+ pg = json_generator_new();
+ g_object_set(pg, "pretty", TRUE, NULL);
+ json_generator_set_root(pg, root);
+
+ pgdata = json_generator_to_data(pg, &len);
+ g_debug("<=(incoming)<=:\n%s\n", pgdata);
+ g_free(pgdata);
+
+ g_object_unref(pg);
+ }
#endif
- ret = json_node_get_object(root);
- json_object_ref(ret);
+ ret = json_node_get_object(root);
+ json_object_ref(ret);
}
g_object_unref(parser);