Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndris Zeila <andris.zeila@zabbix.com>2022-11-04 11:31:10 +0300
committerAndris Zeila <andris.zeila@zabbix.com>2022-11-04 11:42:15 +0300
commit1ffd27468a3c42761a173db50ca7929123201e08 (patch)
tree671ac4d8e8cd293607c9c508bc20f3c83a317670 /tests
parent6c979a2f11f20bf2e5781740761ae6986b17a158 (diff)
.......PS. [ZBXNEXT-8009] added jsonpath optimizations
Merge in ZBX/zabbix from feature/ZBXNEXT-8009-5.0 to release/5.0 * commit '9d6ad3d8f6bc1017a3777a63c7265fa7f18f0962': .......PS. [ZBXNEXT-8009] added check for zero length path .......PS. [ZBXNEXT-8009] fixed jsonpath conversion to text .......PS. [ZBXNEXT-8009] fixed crash if non simple path is present in jsonpath expression .D........ [ZBXNEXT-8009] added changelog entry .......PS. [ZBXNEXT-8009] added jsonpath optimization to stop at the first match if no more data are needed .......PS. [ZBXNEXT-8009] added precompilation of object references inside jsonpath expressions (cherry picked from commit f0e95dab5d82c48ff59536acc4896e3f322462fb)
Diffstat (limited to 'tests')
-rw-r--r--tests/libs/zbxjson/zbx_jsonpath_compile.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/libs/zbxjson/zbx_jsonpath_compile.c b/tests/libs/zbxjson/zbx_jsonpath_compile.c
index f83987ada58..05728efd119 100644
--- a/tests/libs/zbxjson/zbx_jsonpath_compile.c
+++ b/tests/libs/zbxjson/zbx_jsonpath_compile.c
@@ -28,6 +28,8 @@
#include "../../../src/libs/zbxjson/jsonpath.h"
#include "../../../src/libs/zbxjson/json.h"
+static char *segment_data_to_str(const zbx_jsonpath_segment_t *segment);
+
static int mock_str_to_segment_type(const char *segment_type)
{
if (0 == strcmp("ZBX_JSONPATH_SEGMENT_MATCH_ALL", segment_type))
@@ -48,13 +50,15 @@ static int mock_str_to_segment_type(const char *segment_type)
static void jsonpath_token_print(char **data, size_t *data_alloc, size_t *data_offset,
const zbx_jsonpath_token_t *token)
{
+ int i;
+
switch (token->type)
{
case ZBX_JSONPATH_TOKEN_PATH_ABSOLUTE:
case ZBX_JSONPATH_TOKEN_PATH_RELATIVE:
case ZBX_JSONPATH_TOKEN_CONST_STR:
case ZBX_JSONPATH_TOKEN_CONST_NUM:
- zbx_strcpy_alloc(data, data_alloc, data_offset, token->data);
+ zbx_strcpy_alloc(data, data_alloc, data_offset, token->text);
break;
case ZBX_JSONPATH_TOKEN_PAREN_LEFT:
zbx_strcpy_alloc(data, data_alloc, data_offset, "(");