Commit Graph

543 Commits

Author SHA1 Message Date
Eric Haszlakiewicz
3948fcad2d Issue #300: Cast size_t values to int instead of unsigned long long to work around broken behavior of MinGW. 2017-02-05 17:00:35 +00:00
Eric Haszlakiewicz
bad6c9a427 Issue #300: Some platforms, such as MinGW, don't have ETXTBSY and ENOTBLK, so skip those there. 2017-02-05 04:44:30 +00:00
Eric Haszlakiewicz
9a64fd7d55 Issue #300: Use %p instead of %lx in test_util_file since some platforms' pointers are larger than "unsigned long".
Also, there's no need to worry about output consistency here, since it'll be
 different anyway due to different pointer values.
2017-02-05 04:38:53 +00:00
Eric Haszlakiewicz
91977159ee Add cast to int in calls to isdigit() since some platforms complain about char being used as an array index. 2017-02-05 04:34:05 +00:00
Eric Haszlakiewicz
3fab117e4e Merge pull request #299 from qlyoung/perf-improvements
Improve json_object -> string performance
2017-02-04 11:13:14 -05:00
Quentin Young
f6f852fd93 Restore sprintbuf(), add macro for string literals
Hawciz pointed out that the previous commit modifies the public
interface of printbuf. Per his suggestion, sprintbuf() was restored
and a new pair of macros was added that wraps printbuf_memappend().

Using a wrapper macro instead of modifying sprintbuf() also reduces
function call overhead, bringing total performance gains to
approximately 400%.
2017-02-04 01:02:00 +00:00
Eric Haszlakiewicz
75825a9f01 Use strdup instead of strndup in test1.c, there's no need for the latter because json_object_to_json_string_length() will always return a properly sized string. 2017-02-03 17:10:27 +00:00
Quentin Young
9ff0f4987f Improve json_object -> string performance
Removes variadic prints for ~3x performance improvement.
2017-02-02 17:33:54 +00:00
Eric Haszlakiewicz
8157784483 Issue #295: also check if size_t is the size of long long, to help support 64-bit Windows platforms. 2017-01-07 22:55:31 -05:00
Eric Haszlakiewicz
177c401e02 Ignore tests/test_float 2016-12-18 14:35:06 -05:00
Eric Haszlakiewicz
0a010a59eb Change a memcpy that should be a memmove within json_pointer_get, and fix memory leaks in of one the json_pointer tests. 2016-12-18 14:33:41 -05:00
Eric Haszlakiewicz
779b77a164 Note some minimum versions needed for autoconf, etc... 2016-12-12 23:01:20 -05:00
Eric Haszlakiewicz
a443b9f7e7 Issue#292: bump the required version of configure listed in configure.ac so a more useful error message is generated, rather than failing later because the extra macros from ./autoconf-archive/m4/ didn't get loaded. 2016-12-11 19:18:33 -08:00
Eric Haszlakiewicz
1e4824a841 Merge pull request #289 from jgerhards/i-278
bugfix: floating point representaion without fractional part
2016-12-04 20:52:33 -05:00
Jan Gerhards
61db4cfac5 testbench: add test for floating point representation 2016-11-27 11:50:48 +01:00
Jan Gerhards
ca7a1973e2 bugfix: floating point representaion without fractional part
closes https://github.com/json-c/json-c/issues/278
2016-11-27 11:47:00 +01:00
Eric Haszlakiewicz
d050f1e622 Merge pull request #287 from commodo/json_pointer_va_args
json_pointer: extend setter & getter with printf() style arguments
2016-11-24 15:03:50 -05:00
Alexandru Ardelean
47f32a76ef vasprintf_compat.h: spin-off this compat header ; use math_compat.h as template
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-22 16:37:30 +02:00
Alexandru Ardelean
8cb86a583a strdup_compat.h: re-spin this compat header ; use math_compat.h as template
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-22 16:37:29 +02:00
Alexandru Ardelean
c0da680f13 test_json_pointer: update test with a few printf variants
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-22 16:37:18 +02:00
Alexandru Ardelean
742e059da1 json_pointer: add json_pointer_getf/setf() function variants
These include support for printf() style args for path.

Adds support for calling with 'json_pointer_getf(obj, &res, "/foo/%d/%s", 0, bar)'
style args.

Makes it easier for doing more dynamic stuff/magic, without
needing to use vasprintf() externally.

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-22 16:33:49 +02:00
Alexandru Ardelean
97dd7d5103 json_pointer.c: fix whitespace
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-16 16:15:53 +02:00
Eric Haszlakiewicz
8e12f4a21c Merge pull request #285 from ebassi/revert-strdup-compat
Revert "compat/strdup.h: move common compat check for strdup() to own…
2016-11-09 09:56:58 -05:00
Emmanuele Bassi
7601f20d70 Revert "compat/strdup.h: move common compat check for strdup() to own file"
This reverts commit aaba8c1080.

This commit breaks builddir != srcdir build, but, more importantly, it
also adds a dependency on a header, "config.h", which is not installed
and it's supposed to be private — since it's generated at configuration
time and it's not meant to be used by projects compiling against a
library.
2016-11-07 20:51:11 +00:00
Eric Haszlakiewicz
e8ce1db471 Merge pull request #283 from commodo/json_pointer
json_pointer: add first revision based on RFC 6901
2016-11-04 11:48:30 -04:00
Alexandru Ardelean
ee7fc26de1 tests: add test_json_pointer test
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-04 09:59:43 +02:00
Alexandru Ardelean
2fbdee19da tests/strerror_override.c: fix compilation error
I got this on Mac OS X at least.
Not sure if it shows up in other envs

error:
```
strerror_override.c:53:13: error: incompatible redeclaration of library function 'strerror' [-Werror,-Wincompatible-library-redeclaration]
const char *strerror(int errno_in)
```

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-04 09:51:44 +02:00
Alexandru Ardelean
0e91183300 json_pointer: add first revision
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-04 09:51:36 +02:00
Alexandru Ardelean
aaba8c1080 compat/strdup.h: move common compat check for strdup() to own file
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2016-11-03 15:51:33 +02:00
Eric Haszlakiewicz
d4899bd4d5 Handle NULL objects in json_object_get_userdata() by returning NULL, but abort in json_object_set_userdata() since we can't actually do anything with the userdata. 2016-10-29 15:42:36 -04:00
Eric Haszlakiewicz
f8132f932d Issue #280: add a few assert() calls to ensure objects are of the appropriate type. 2016-10-29 15:31:31 -04:00
Eric Haszlakiewicz
33339ae595 Use json_visit() to clear the serializer data set when parsing so the output from test_parse reflects the actual values parsed. 2016-10-29 15:13:16 -04:00
Eric Haszlakiewicz
ecdc14f535 Add a json_c_visit() function to provide a way to iterate over a tree of json-c objects. 2016-10-29 15:01:20 -04:00
Eric Haszlakiewicz
7e12b9f47c Fix broken key-order test in test_compare. 2016-10-10 00:13:39 -04:00
Eric Haszlakiewicz
80150a18d3 Merge pull request #272 from sgerbino/master
Allows for compilation with CMake on macOS
2016-10-08 13:13:33 -04:00
Eric Haszlakiewicz
818156f6f7 Merge pull request #277 from ALLTERCO/json_object_set_xxx
Json object set xxx
2016-10-08 12:08:53 -04:00
Stoian Ivanov
be63ba99ca try restore windows automated builds 2016-10-07 22:54:06 +03:00
Stoian Ivanov
a26305d428 fix compiler warning for int sizes 2016-10-07 01:07:34 +03:00
Stoian Ivanov
e518b22b72 string set and tests 2016-10-07 00:51:24 +03:00
Stoian Ivanov
9a313f767f gitignore test; add double value set checks in test 2016-10-06 23:32:19 +03:00
Stoian Ivanov
6a0667567d some simple tests 2016-10-06 23:16:29 +03:00
Eric Haszlakiewicz
36a28fcb0c Issue #275: fix out of bounds read when handling unicode surrogate pairs. 2016-10-05 23:15:51 -04:00
Stoian Ivanov
05f025c075 some basic set 2016-10-05 23:55:46 +03:00
Eric Haszlakiewicz
5fd99e62ed Merge pull request #273 from konoal/master
fixed wrong object name in json_object_all_values_equal
2016-09-28 08:08:01 -04:00
Eric Haszlakiewicz
5653bc61a4 Merge pull request #274 from pepevel/master
Support for 64 bit pointers on Windows
2016-09-28 08:05:50 -04:00
pepevel
0df34b4c96 Support for 64 bit pointers on Windows 2016-09-27 20:12:03 +01:00
Alexey Konovalov
b2fbf93df0 fixed wrong object name in json_object_all_values_equal 2016-09-27 11:20:49 +03:00
Steve Gerbino
c5c93724fe Changed CMake variables and adding output for debugging 2016-09-26 00:19:46 -04:00
Steve Gerbino
0c749d96ea Target C99 standards to get rid of warnings 2016-09-26 00:09:55 -04:00
Steve Gerbino
928858457b Modified the execute_process commands 2016-09-25 23:08:39 -04:00