csonpath 0.12.0__tar.gz → 0.13.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {csonpath-0.12.0 → csonpath-0.13.0}/Makefile +6 -2
  2. {csonpath-0.12.0/csonpath.egg-info → csonpath-0.13.0}/PKG-INFO +1 -1
  3. {csonpath-0.12.0 → csonpath-0.13.0/csonpath.egg-info}/PKG-INFO +1 -1
  4. {csonpath-0.12.0 → csonpath-0.13.0}/csonpath.h +14 -12
  5. {csonpath-0.12.0 → csonpath-0.13.0}/csonpath_do.h +4 -4
  6. {csonpath-0.12.0 → csonpath-0.13.0}/csonpath_python.c +3 -2
  7. {csonpath-0.12.0 → csonpath-0.13.0}/pyproject.toml +2 -2
  8. {csonpath-0.12.0 → csonpath-0.13.0}/LICENSE +0 -0
  9. {csonpath-0.12.0 → csonpath-0.13.0}/MANIFEST.in +0 -0
  10. {csonpath-0.12.0 → csonpath-0.13.0}/README.md +0 -0
  11. {csonpath-0.12.0 → csonpath-0.13.0}/configure +0 -0
  12. {csonpath-0.12.0 → csonpath-0.13.0}/csonpath.egg-info/SOURCES.txt +0 -0
  13. {csonpath-0.12.0 → csonpath-0.13.0}/csonpath.egg-info/dependency_links.txt +0 -0
  14. {csonpath-0.12.0 → csonpath-0.13.0}/csonpath.egg-info/requires.txt +0 -0
  15. {csonpath-0.12.0 → csonpath-0.13.0}/csonpath.egg-info/top_level.txt +0 -0
  16. {csonpath-0.12.0 → csonpath-0.13.0}/csonpath_json-c.h +0 -0
  17. {csonpath-0.12.0 → csonpath-0.13.0}/csonpath_yyjson.h +0 -0
  18. {csonpath-0.12.0 → csonpath-0.13.0}/setup.cfg +0 -0
  19. {csonpath-0.12.0 → csonpath-0.13.0}/setup.py +0 -0
  20. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/.git +0 -0
  21. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/.github/workflows/c-cpp.yml +0 -0
  22. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/.gitignore +0 -0
  23. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/LICENSE +0 -0
  24. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/Makefile +0 -0
  25. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/README.md +0 -0
  26. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/clib.json +0 -0
  27. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/formal_verification.md +0 -0
  28. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/re.c +0 -0
  29. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/re.h +0 -0
  30. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/scripts/exrex.py +0 -0
  31. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/scripts/regex_test.py +0 -0
  32. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/scripts/regex_test_neg.py +0 -0
  33. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/tests/test1.c +0 -0
  34. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/tests/test2.c +0 -0
  35. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/tests/test3.c +0 -0
  36. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/tests/test_compile.c +0 -0
  37. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/tests/test_print.c +0 -0
  38. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/tests/test_rand.c +0 -0
  39. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/tests/test_rand_neg.c +0 -0
  40. {csonpath-0.12.0 → csonpath-0.13.0}/tiny-regex-c/tests/test_thread.c +0 -0
@@ -3,7 +3,7 @@ JSON_C_LDFLAGS=$(shell pkg-config --libs json-c)
3
3
 
4
4
  include config.mk
5
5
 
6
- all: test-json-c-get-a test-json-update test-json-filter test-json-subpath
6
+ all: test-json-c-get-a test-json-update test-json-filter test-json-subpath test-json-c-array-root
7
7
 
8
8
  bench:
9
9
  make -C bench
@@ -18,6 +18,9 @@ CFLAGS+= -Wall -Wextra -Wno-unused-function -Wno-unused-parameter -O0 -g
18
18
  test-json-c-get-a: tests/json-c/get-a.c $(EXTRA_FILES) csonpath_json-c.h csonpath.h csonpath_do.h
19
19
  $(CC) tests/json-c/get-a.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-c-get-a $(JSON_C_LDFLAGS) $(LDFLAGS)
20
20
 
21
+ test-json-c-array-root: tests/json-c/root-array.c $(EXTRA_FILES) csonpath_json-c.h csonpath.h csonpath_do.h
22
+ $(CC) tests/json-c/root-array.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-c-array-root $(JSON_C_LDFLAGS) $(LDFLAGS)
23
+
21
24
  test-json-update: tests/json-c/set-a.c csonpath_json-c.h csonpath.h csonpath_do.h
22
25
  $(CC) tests/json-c/set-a.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-update $(JSON_C_LDFLAGS) $(LDFLAGS)
23
26
 
@@ -27,11 +30,12 @@ test-json-filter: tests/json-c/filter.c csonpath_json-c.h csonpath.h csonpath_do
27
30
  test-json-subpath: tests/json-c/subpath.c csonpath_json-c.h csonpath.h csonpath_do.h
28
31
  $(CC) tests/json-c/subpath.c $(EXTRA_FILES) $(JSON_C_CFLAGS) $(CFLAGS) -Wno-format -I./ -o test-json-subpath $(JSON_C_LDFLAGS) $(LDFLAGS)
29
32
 
30
- tests-c: test-json-c-get-a test-json-update test-json-filter test-json-subpath
33
+ tests-c: test-json-c-get-a test-json-update test-json-filter test-json-subpath test-json-c-array-root
31
34
  ./test-json-c-get-a
32
35
  ./test-json-update
33
36
  ./test-json-filter
34
37
  ./test-json-subpath
38
+ ./test-json-c-array-root
35
39
 
36
40
  pip-dev:
37
41
  pip install -e .[dev] --force-reinstall
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csonpath
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Provides-Extra: dev
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csonpath
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Description-Content-Type: text/markdown
5
5
  License-File: LICENSE
6
6
  Provides-Extra: dev
@@ -918,9 +918,9 @@ need_reloop_in = 0;
918
918
  #define CSONPATH_NONE_FOUND_RET CSONPATH_NULL
919
919
 
920
920
  #define CSONPATH_GETTER_ERR(args...) do { \
921
- fprintf(stderr, args); \
922
- return CSONPATH_NULL; \
923
- } while (0)
921
+ CSONPATH_FORMAT_EXCEPTION(args); \
922
+ return CSONPATH_NULL; \
923
+ } while (0)
924
924
 
925
925
  /* Find First */
926
926
 
@@ -980,10 +980,10 @@ need_reloop_in = 0;
980
980
 
981
981
  #define CSONPATH_NONE_FOUND_RET 0
982
982
 
983
- #define CSONPATH_GETTER_ERR(args...) do { \
984
- fprintf(stderr, args); \
985
- return -1; \
986
- } while (0)
983
+ #define CSONPATH_GETTER_ERR(args...) do { \
984
+ CSONPATH_FORMAT_EXCEPTION(args); \
985
+ return -1; \
986
+ } while (0)
987
987
 
988
988
  #define CSONPATH_DO_ON_FOUND
989
989
 
@@ -1104,7 +1104,8 @@ static int csonpath_sync_root_array(CSONPATH_JSON parent, CSONPATH_JSON to_updat
1104
1104
 
1105
1105
  CSONPATH_ARRAY_CLEAR(parent);
1106
1106
  CSONPATH_FOREACH_ARRAY(to_update, child, idx) {
1107
- CSONPATH_APPEND_AT(parent, idx, child);
1107
+ if (CSONPATH_APPEND_AT(parent, idx, child) < 0)
1108
+ return -1;
1108
1109
  }
1109
1110
  return 1;
1110
1111
  }
@@ -1116,7 +1117,8 @@ static int csonpath_sync_root_obj(CSONPATH_JSON parent, CSONPATH_JSON to_update)
1116
1117
 
1117
1118
  CSONPATH_OBJ_CLEAR(parent);
1118
1119
  CSONPATH_FOREACH_OBJ(to_update, child, key) {
1119
- CSONPATH_APPEND_AT(parent, key, child);
1120
+ if (CSONPATH_APPEND_AT(parent, key, child) < 0)
1121
+ return -1;
1120
1122
  }
1121
1123
  return 1;
1122
1124
  }
@@ -1129,7 +1131,7 @@ static int csonpath_sync_root_obj(CSONPATH_JSON parent, CSONPATH_JSON to_update)
1129
1131
  } else if (CSONPATH_IS_ARRAY(origin) && CSONPATH_IS_ARRAY(to_update)) { \
1130
1132
  return csonpath_sync_root_array(origin, to_update); \
1131
1133
  } else { \
1132
- CSONPATH_EXCEPTION("can't upate root ($)\n"); \
1134
+ CSONPATH_EXCEPTION("can't update root ($)\n"); \
1133
1135
  } \
1134
1136
  }
1135
1137
 
@@ -1141,7 +1143,7 @@ static int csonpath_sync_root_obj(CSONPATH_JSON parent, CSONPATH_JSON to_update)
1141
1143
  to_check = *check_at; \
1142
1144
  } while (to_check == CSONPATH_INST_GET_ALL || to_check == CSONPATH_INST_FIND_ALL); \
1143
1145
  if (to_check == CSONPATH_INST_END || to_check == CSONPATH_INST_OR) { \
1144
- CSONPATH_APPEND_AT(ctx, this_idx, to_update); \
1146
+ if (CSONPATH_APPEND_AT(ctx, this_idx, to_update) < 0) return -1; \
1145
1147
  return 1; \
1146
1148
  }
1147
1149
 
@@ -1215,7 +1217,7 @@ static int csonpath_sync_root_obj(CSONPATH_JSON parent, CSONPATH_JSON to_update)
1215
1217
  #define CSONPATH_PRE_GET_ROOT \
1216
1218
  int to_check = *walker; \
1217
1219
  if (to_check == CSONPATH_INST_END || to_check == CSONPATH_INST_OR) { \
1218
- CSONPATH_GETTER_ERR("can't upate root ($)\n"); \
1220
+ CSONPATH_GETTER_ERR("can't update root ($)\n"); \
1219
1221
  return CSONPATH_NONE_FOUND_RET; \
1220
1222
  }
1221
1223
 
@@ -1,7 +1,7 @@
1
1
  #ifndef CSONPATH_DO_GET_NOTFOUND
2
2
  #define CSONPATH_DO_GET_NOTFOUND(this_idx) \
3
- do { \
4
- walker += 1; \
3
+ do { \
4
+ walker += 1; \
5
5
  while (*walker != CSONPATH_INST_END) { \
6
6
  if (*walker == CSONPATH_INST_OR) { \
7
7
  goto next_inst; \
@@ -369,10 +369,10 @@ static CSONPATH_DO_RET_TYPE csonpath_do_internal(const struct csonpath cjp[const
369
369
  this_idx = (int)walker[1];
370
370
  CSONPATH_PRE_GET(this_idx);
371
371
  tmp = CSONPATH_AT(tmp, this_idx);
372
+ walker += 1;
372
373
  if (tmp == CSONPATH_NULL) {
373
374
  CSONPATH_DO_GET_NOTFOUND(this_idx);
374
375
  }
375
- walker += 1;
376
376
  CSONPATH_DO_POST_FIND_ARRAY;
377
377
  break;
378
378
  }
@@ -385,10 +385,10 @@ static CSONPATH_DO_RET_TYPE csonpath_do_internal(const struct csonpath cjp[const
385
385
  this_idx = to_num.n;
386
386
  CSONPATH_PRE_GET(this_idx);
387
387
  tmp = CSONPATH_AT(tmp, to_num.n);
388
+ walker += 5;
388
389
  if (tmp == CSONPATH_NULL) {
389
390
  CSONPATH_DO_GET_NOTFOUND(this_idx);
390
391
  }
391
- walker += 5;
392
392
  CSONPATH_DO_POST_FIND_ARRAY;
393
393
  break;
394
394
  }
@@ -313,10 +313,11 @@ static PyObject *update_or_create(PyCsonPathObject *self, PyObject* args)
313
313
  PyObject *value;
314
314
 
315
315
  if (!PyArg_ParseTuple(args, "OO", &json, &value))
316
- BAD_ARG();
316
+ BAD_ARG();
317
317
  int ret = csonpath_update_or_create(self->cp, json, value);
318
- if (ret < 0)
318
+ if (ret < 0) {
319
319
  return NULL;
320
+ }
320
321
  return PyLong_FromLong(ret);
321
322
  }
322
323
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "csonpath"
7
- version = "0.12.0"
7
+ version = "0.13.0"
8
8
  readme = "README.md"
9
9
 
10
10
  [tool.setuptools]
@@ -27,7 +27,7 @@ test-command = "pytest {project}/tests/python"
27
27
  before-build = "choco install mingw -y"
28
28
 
29
29
  [tool.bumpversion]
30
- current_version = "0.12.0"
30
+ current_version = "0.13.0"
31
31
  parse = "(?P<major>\\d+)\\.(?P<minor>\\d+)\\.(?P<patch>\\d+)"
32
32
  serialize = ["{major}.{minor}.{patch}"]
33
33
  search = "{current_version}"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes