summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--anteraja.c7
-rw-r--r--handler.h7
2 files changed, 7 insertions, 7 deletions
diff --git a/anteraja.c b/anteraja.c
index 5e5111d..462ff5d 100644
--- a/anteraja.c
+++ b/anteraja.c
@@ -1,6 +1,3 @@
-#ifdef DEBUG
-#include <stdio.h>
-#endif
#include "shipping.h"
#include "handler.h"
@@ -40,10 +37,6 @@ size_t anteraja_services_handle(const char *contents, size_t size, size_t nmemb,
struct pikul_services **services)
{
size_t realsize = size * nmemb;
-#ifdef DEBUG
- ((char *)contents)[realsize] = '\0';
- fprintf(stderr, "%s\n", contents);
-#endif
handle_services(contents, realsize, status_trail, (const char *[]){
"content",
"services",
diff --git a/handler.h b/handler.h
index 7b2ac90..9c46975 100644
--- a/handler.h
+++ b/handler.h
@@ -1,3 +1,6 @@
+#ifdef DEBUG
+#include <stdio.h>
+#endif
#include <string.h>
#include <json.h>
#include "pikul.h"
@@ -8,6 +11,10 @@ void recurse(struct json_object *, const char *[], struct json_object **);
inline void handle_services(const char *contents, size_t num_bytes, const char *status_trail[],
const char *trail[], const char *attributes[], struct pikul_services **services)
{
+#ifdef DEBUG
+ ((char *)contents)[num_bytes] = '\0';
+ fprintf(stderr, "%s\n", contents);
+#endif
json_object *response = json_tokener_parse_ex(tokener, contents, num_bytes);
enum json_tokener_error error = json_tokener_get_error(tokener);
if (!response) {