]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: mjson: remove unused defines from mjson.h
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 6 Oct 2025 07:26:36 +0000 (09:26 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 6 Oct 2025 07:30:07 +0000 (09:30 +0200)
This patch removes unused defines from mjson.h.
It also removes unused c++ declarations and includes.

string.h is moved to mjson.c

include/import/mjson.h
src/mjson.c

index 1d4583ac2b4c15b36f61588bdcdc2fe008f91ae6..043ca2b699e2614a57e82de88e5a08463cf43ead 100644 (file)
 #ifndef MJSON_H
 #define MJSON_H
 
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef MJSON_ENABLE_PRINT
-#define MJSON_ENABLE_PRINT 1
-#endif
-
-#ifndef MJSON_ENABLE_RPC
-#define MJSON_ENABLE_RPC 1
-#endif
-
-#ifndef MJSON_ENABLE_BASE64
-#define MJSON_ENABLE_BASE64 1
-#endif
-
-#ifndef MJSON_ENABLE_MERGE
-#define MJSON_ENABLE_MERGE 0
-#elif MJSON_ENABLE_MERGE
-#define MJSON_ENABLE_NEXT 1
-#endif
-
-#ifndef MJSON_ENABLE_PRETTY
-#define MJSON_ENABLE_PRETTY 0
-#elif MJSON_ENABLE_PRETTY
-#define MJSON_ENABLE_NEXT 1
-#endif
-
-#ifndef MJSON_ENABLE_NEXT
-#define MJSON_ENABLE_NEXT 0
-#endif
-
-#ifndef MJSON_RPC_LIST_NAME
-#define MJSON_RPC_LIST_NAME "rpc.list"
-#endif
-
-#ifndef MJSON_DYNBUF_CHUNK
-#define MJSON_DYNBUF_CHUNK 256  // Allocation granularity for print_dynamic_buf
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 enum {
   MJSON_ERROR_INVALID_INPUT = -1,
   MJSON_ERROR_TOO_DEEP = -2,
@@ -98,7 +54,4 @@ int mjson_get_bool(const char *s, int len, const char *path, int *v);
 int mjson_get_string(const char *s, int len, const char *path, char *to, int n);
 int mjson_get_hex(const char *s, int len, const char *path, char *to, int n);
 
-#ifdef __cplusplus
-}
-#endif
 #endif  // MJSON_H
index 3214a5bf1d409c4772c56075d0d91f32ac0afe39..a36fe185f95e420560d549a4b3347e4ca6dec236 100644 (file)
@@ -20,6 +20,7 @@
 // SOFTWARE.
 
 #include <float.h>
+#include <string.h>
 
 #include <import/mjson.h>