From 3f3ed71fe72cb5a1710be9138e5e4b8106ae810f Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 18 Feb 2016 12:42:31 +0100 Subject: [PATCH] jansson: cleanup JSON_ESCAPE_SLASH use --- src/output-json.c | 7 +------ src/suricata-common.h | 3 +++ src/unix-manager.c | 7 +------ src/util-debug.c | 7 +------ src/util-profiling-rules.c | 7 +------ 5 files changed, 7 insertions(+), 24 deletions(-) diff --git a/src/output-json.c b/src/output-json.c index 69e5c577e0..9106ca2bee 100644 --- a/src/output-json.c +++ b/src/output-json.c @@ -364,12 +364,7 @@ int OutputJSONBuffer(json_t *js, LogFileCtx *file_ctx, MemBuffer **buffer) int r = json_dump_callback(js, OutputJSONMemBufferCallback, &wrapper, JSON_PRESERVE_ORDER|JSON_COMPACT|JSON_ENSURE_ASCII| -#ifdef JSON_ESCAPE_SLASH - JSON_ESCAPE_SLASH -#else - 0 -#endif - ); + JSON_ESCAPE_SLASH); if (r != 0) return TM_ECODE_OK; diff --git a/src/suricata-common.h b/src/suricata-common.h index df3ef79bee..05bfcdf9ec 100644 --- a/src/suricata-common.h +++ b/src/suricata-common.h @@ -212,6 +212,9 @@ #ifdef HAVE_LIBJANSSON #include +#ifndef JSON_ESCAPE_SLASH +#define JSON_ESCAPE_SLASH 0 +#endif #endif #if CPPCHECK==1 diff --git a/src/unix-manager.c b/src/unix-manager.c index 414d99f7f9..29fe4b8a60 100644 --- a/src/unix-manager.c +++ b/src/unix-manager.c @@ -290,12 +290,7 @@ int UnixCommandSendJSONToClient(UnixClient *client, json_t *js) int r = json_dump_callback(js, OutputJSONMemBufferCallback, &wrapper, JSON_PRESERVE_ORDER|JSON_COMPACT|JSON_ENSURE_ASCII| -#ifdef JSON_ESCAPE_SLASH - JSON_ESCAPE_SLASH -#else - 0 -#endif - ); + JSON_ESCAPE_SLASH); if (r != 0) { SCLogWarning(SC_ERR_SOCKET, "unable to serialize JSON object"); return -1; diff --git a/src/util-debug.c b/src/util-debug.c index c439cd78c0..e1a9af4539 100644 --- a/src/util-debug.c +++ b/src/util-debug.c @@ -233,12 +233,7 @@ int SCLogMessageJSON(struct timeval *tval, char *buffer, size_t buffer_size, char *js_s = json_dumps(js, JSON_PRESERVE_ORDER|JSON_COMPACT|JSON_ENSURE_ASCII| -#ifdef JSON_ESCAPE_SLASH - JSON_ESCAPE_SLASH -#else - 0 -#endif - ); + JSON_ESCAPE_SLASH); snprintf(buffer, buffer_size, "%s", js_s); free(js_s); diff --git a/src/util-profiling-rules.c b/src/util-profiling-rules.c index 945bc8b3c2..3d679384bb 100644 --- a/src/util-profiling-rules.c +++ b/src/util-profiling-rules.c @@ -341,12 +341,7 @@ static void DumpJson(FILE *fp, SCProfileSummary *summary, uint32_t count, uint64 char *js_s = json_dumps(js, JSON_PRESERVE_ORDER|JSON_COMPACT|JSON_ENSURE_ASCII| -#ifdef JSON_ESCAPE_SLASH - JSON_ESCAPE_SLASH -#else - 0 -#endif - ); + JSON_ESCAPE_SLASH); if (unlikely(js_s == NULL)) return; -- 2.47.2