From 80be061c3d914a15faa004e7f56d7c12bc27a0a5 Mon Sep 17 00:00:00 2001 From: ckolivas Date: Mon, 16 Mar 2015 10:07:26 +1100 Subject: [PATCH] Make json encoded errormsgs part of api.c for general use --- src/generator.c | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/generator.c b/src/generator.c index 97199976..ad8fd17d 100644 --- a/src/generator.c +++ b/src/generator.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -2120,33 +2119,6 @@ static void send_list(gdata_t *gdata, const int sockd) send_api_response(val, sockd); } -static json_t *_json_encode_errormsg(json_error_t *err_val, const char *func) -{ - json_t *ret; - char *buf; - - ASPRINTF(&buf, "Failed to JSON decode in %s (%d):%s", func, err_val->line, err_val->text); - JSON_CPACK(ret, "{ss}", "errormsg", buf); - free(buf); - return ret; -} - -#define json_encode_errormsg(err_val) _json_encode_errormsg(err_val, __func__) - -static json_t *json_errormsg(const char *fmt, ...) -{ - char *buf = NULL; - json_t *ret; - va_list ap; - - va_start(ap, fmt); - VASPRINTF(&buf, fmt, ap); - va_end(ap); - JSON_CPACK(ret, "{ss}", "errormsg", buf); - free(buf); - return ret; -} - static void send_sublist(gdata_t *gdata, const int sockd, const char *buf) { proxy_instance_t *proxy, *subproxy, *tmp;