diff options
author | Dario Lombardo <lomato@gmail.com> | 2018-04-20 16:55:00 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2018-04-21 07:13:31 +0000 |
commit | 57fee051c6a37ab152d303be4d156c8e5c64b36a (patch) | |
tree | 68bc4d1d14e3a1cb4ce738018cabb2a83febe696 | |
parent | 119a497652d2436824a733c0c853dbdc80aaf9eb (diff) |
wsutil: rename wsjsmn to wsjson.
This puts more distance between the caller and the underlying
library. At the moment we're using libjsmn, but other libraries
(like json-glib) could be used.
Change-Id: I1431424a998fc8188ad47b71d6d95afdc92a3f9e
Reviewed-on: https://code.wireshark.org/review/27055
Petri-Dish: Dario Lombardo <lomato@gmail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r-- | debian/libwsutil0.symbols | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-json.c | 2 | ||||
-rw-r--r-- | sharkd_session.c | 8 | ||||
-rw-r--r-- | wiretap/json.c | 2 | ||||
-rw-r--r-- | wsutil/CMakeLists.txt | 4 | ||||
-rw-r--r-- | wsutil/wsjson.c (renamed from wsutil/wsjsmn.c) | 8 | ||||
-rw-r--r-- | wsutil/wsjson.h (renamed from wsutil/wsjsmn.h) | 10 |
7 files changed, 19 insertions, 19 deletions
diff --git a/debian/libwsutil0.symbols b/debian/libwsutil0.symbols index 550e73b91c..52e6e93d5b 100644 --- a/debian/libwsutil0.symbols +++ b/debian/libwsutil0.symbols @@ -192,5 +192,5 @@ libwsutil.so.0 libwsutil0 #MINVER# ws_utf8_char_len@Base 1.12.0~rc1 ws_vadd_crash_info@Base 2.5.2 ws_xton@Base 1.12.0~rc1 - wsjsmn_parse@Base 2.3.0 - wsjsmn_unescape_json_string@Base 2.5.0 + wsjson_parse@Base 2.3.0 + wsjson_unescape_json_string@Base 2.5.0 diff --git a/epan/dissectors/packet-json.c b/epan/dissectors/packet-json.c index 034e1fb8bc..5d309a74b6 100644 --- a/epan/dissectors/packet-json.c +++ b/epan/dissectors/packet-json.c @@ -19,7 +19,7 @@ #include <epan/packet.h> #include <epan/tvbparse.h> -#include <wsutil/wsjsmn.h> +#include <wsutil/wsjson.h> #include <wsutil/str_util.h> #include <wsutil/unicode-utils.h> diff --git a/sharkd_session.c b/sharkd_session.c index 2c2f9262c9..bffacf4b3e 100644 --- a/sharkd_session.c +++ b/sharkd_session.c @@ -18,7 +18,7 @@ #include <glib.h> -#include <wsutil/wsjsmn.h> +#include <wsutil/wsjson.h> #include <wsutil/ws_printf.h> #include <file.h> @@ -79,7 +79,7 @@ static GHashTable *filter_table = NULL; static gboolean json_unescape_str(char *input) { - return wsjsmn_unescape_json_string(input, input); + return wsjson_unescape_json_string(input, input); } static const char * @@ -4008,7 +4008,7 @@ sharkd_session_main(void) /* every command is line seperated JSON */ int ret; - ret = wsjsmn_parse(buf, NULL, 0); + ret = wsjson_parse(buf, NULL, 0); if (ret < 0) { fprintf(stderr, "invalid JSON -> closing\n"); @@ -4026,7 +4026,7 @@ sharkd_session_main(void) memset(tokens, 0, ret * sizeof(jsmntok_t)); - ret = wsjsmn_parse(buf, tokens, ret); + ret = wsjson_parse(buf, tokens, ret); if (ret < 0) { fprintf(stderr, "invalid JSON(2) -> closing\n"); diff --git a/wiretap/json.c b/wiretap/json.c index 8f5064de47..8ced65797a 100644 --- a/wiretap/json.c +++ b/wiretap/json.c @@ -13,7 +13,7 @@ #include "file_wrappers.h" #include "json.h" -#include <wsutil/wsjsmn.h> +#include <wsutil/wsjson.h> static gboolean json_read_file(wtap *wth, FILE_T fh, wtap_rec *rec, Buffer *buf, int *err, gchar **err_info) diff --git a/wsutil/CMakeLists.txt b/wsutil/CMakeLists.txt index ad477791d7..7ee405a334 100644 --- a/wsutil/CMakeLists.txt +++ b/wsutil/CMakeLists.txt @@ -68,7 +68,7 @@ set(WSUTIL_PUBLIC_HEADERS ws_mempbrk_int.h ws_pipe.h ws_printf.h - wsjsmn.h + wsjson.h xtea.h ) @@ -116,7 +116,7 @@ set(WSUTIL_COMMON_FILES ws_mempbrk.c ws_pipe.c wsgcrypt.c - wsjsmn.c + wsjson.c xtea.c ) diff --git a/wsutil/wsjsmn.c b/wsutil/wsjson.c index 991bf667c2..675f2a6ec3 100644 --- a/wsutil/wsjsmn.c +++ b/wsutil/wsjson.c @@ -1,4 +1,4 @@ -/* wsjsmn.c +/* wsjson.c * Utility to check if a payload is json using libjsmn * * Copyright 2016, Dario Lombardo @@ -10,7 +10,7 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ -#include "wsjsmn.h" +#include "wsjson.h" #include <string.h> #include <wsutil/jsmn.h> @@ -58,7 +58,7 @@ gboolean jsmn_is_json(const guint8* buf, const size_t len) return ret; } -int wsjsmn_parse(const char *buf, jsmntok_t *tokens, unsigned int max_tokens) +int wsjson_parse(const char *buf, jsmntok_t *tokens, unsigned int max_tokens) { jsmn_parser p; @@ -66,7 +66,7 @@ int wsjsmn_parse(const char *buf, jsmntok_t *tokens, unsigned int max_tokens) return jsmn_parse(&p, buf, strlen(buf), tokens, max_tokens); } -gboolean wsjsmn_unescape_json_string(const char *input, char *output) +gboolean wsjson_unescape_json_string(const char *input, char *output) { while (*input) { char ch = *input++; diff --git a/wsutil/wsjsmn.h b/wsutil/wsjson.h index 0ef21ca41e..e55f6a991d 100644 --- a/wsutil/wsjsmn.h +++ b/wsutil/wsjson.h @@ -1,4 +1,4 @@ -/* wsjsmn.h +/* wsjson.h * Utility to check if a payload is json using libjsmn * * Copyright 2016, Dario Lombardo @@ -10,8 +10,8 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ -#ifndef __WSJSMN_H__ -#define __WSJSMN_H__ +#ifndef __WSJSON_H__ +#define __WSJSON_H__ #include "ws_symbol_export.h" #include <glib.h> @@ -27,12 +27,12 @@ extern "C" { */ WS_DLL_PUBLIC gboolean jsmn_is_json(const guint8* buf, const size_t len); -WS_DLL_PUBLIC int wsjsmn_parse(const char *buf, jsmntok_t *tokens, unsigned int max_tokens); +WS_DLL_PUBLIC int wsjson_parse(const char *buf, jsmntok_t *tokens, unsigned int max_tokens); /** * Try to unescape input JSON string. output can be the same pointer as input, or must have the same buffer size as input. */ -WS_DLL_PUBLIC gboolean wsjsmn_unescape_json_string(const char *input, char *output); +WS_DLL_PUBLIC gboolean wsjson_unescape_json_string(const char *input, char *output); #ifdef __cplusplus } |