Maxim Zhukov
ca6775dee4
introduce new fixed-size key API
...
This commit added functions working with fixed-size strings (non null-terminated also).
It's helpful for the following cases:
* getting key from substring without copying to separate buffer (better perfomance)
* using pure UTF-8 keys for the objets
* hack: set binary structs as the keys (see test_binary_keys)
added functions:
* json_object_getn
* json_object_setn
* json_object_setn_nocheck
* json_object_setn_new
* json_object_setn_new_nocheck
* json_object_deln
* json_object_iter_key_len
added iterators:
* json_object_keylen_foreach
* json_object_keylen_foreach_safe
Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
2020-09-01 10:22:14 +03:00
Maxim Zhukov
ba4503804b
pass length of the key to internal API
...
Use key length for internal API
Signed-off-by: Maxim Zhukov <mussitantesmortem@gmail.com>
2020-08-12 09:57:14 +03:00
Petri Lehtinen
a8f5fa5f5a
Tweak clang-format configuration a bit
...
Set ColumnLimit to 90, remove AllowShortCaseLabelsOnASingleLine.
2019-10-21 08:56:03 +03:00
Petri Lehtinen
79fe8c3435
Run clang-format on *.c, *.h
2019-10-21 08:55:01 +03:00
Petri Lehtinen
074bb3838f
Update copyrights for 2016
2016-09-18 14:17:03 +03:00
Petri Lehtinen
14573dc920
Merge pull request #293 from akheron/object-insertion-order
...
Always preserve insertion order of object items
2016-08-25 20:20:34 +03:00
Andreas Pasiopoulos
6a4b3f878d
Conform to c89
2016-08-11 18:51:29 +03:00
Andreas Pasiopoulos
86fdf76f79
Check the allocation was successful before freeing existing hashtable buckets
...
and increasing hashtable order
Fixes a crash observed when there is OOM in hashtable_do_rehash
2016-08-11 17:48:29 +03:00
Petri Lehtinen
9df267054f
Always preserve insertion order of object items
2016-06-20 21:10:23 +03:00
Haldean
95dd927857
use snprintf and strncpy in place of sprintf and strcpy
...
This is both good practice and nice for OpenBSD users, who will no
longer get the nag message to not use sprintf/strcpy every time they
link against jansson. It's worth noting that the existing code seems
safe to me - bounds checks were already happening before the actual
calls - and that this is for extra security.
2015-04-30 00:11:25 -07:00
Petri Lehtinen
abaae7630e
Make it possible to set initial hashtable size
...
Fixes #213 .
2014-12-18 14:43:44 +02:00
Petri Lehtinen
17ec22f514
Merge branch '2.6'
2014-02-11 14:49:15 +02:00
Petri Lehtinen
8f80c2d838
CVE-2013-6401: Change hash function, randomize hashes
...
Thanks to Florian Weimer and Eric Sesterhenn for reporting, reviewing
and testing.
2014-02-11 08:41:30 +02:00
Petri Lehtinen
30fdf6067e
Update copyrights for 2014
2014-01-28 09:16:05 +02:00
Petri Lehtinen
30a4c88843
Fix an off-by-one error
2013-10-15 08:49:40 +03:00
Petri Lehtinen
08be94e8e6
Don't call strlen twice
...
Oops.
2013-10-15 08:46:17 +03:00
Petri Lehtinen
d544852ff6
Avoid integer overflows with very long strings
2013-10-15 08:44:04 +03:00
Petri Lehtinen
2489ea90b1
Update copyrights for 2013
2013-07-23 13:20:06 +03:00
Jacob Potter
f86bb0377f
Mark some constant data as const.
...
Issue #95 .
2012-12-10 08:47:00 +02:00
Rogerz Zhang
7ca783c3bc
Add vs2010 solution and project
2012-04-30 21:51:07 +08:00
Petri Lehtinen
ff0c05b8f1
Support building on Windows
...
Jansson now builds correctly with Visual C++ Express 2010.
2012-04-29 22:09:29 +03:00
Petri Lehtinen
3c6e36ba2d
Update copyright notices for 2012
2012-03-20 20:55:55 +02:00
Petri Lehtinen
a2381948bb
Make hashtable less generic
...
This will make it possible to implement json_object_foreach(). It
should also have some (positive) effect on speed.
2012-01-24 21:01:23 +02:00
Andrea Marchesini
ff57dee13d
unsed static variable removed
2011-09-20 11:46:29 +02:00
Petri Lehtinen
eab23f05d8
Fix a few malloc() and free() calls
...
Replace them with jsonp_malloc() and jsonp_free() to support the
custom memory allocation.
2011-03-31 16:37:43 +03:00
Petri Lehtinen
4be9e9e7fe
Add custom memory allocation
...
Thanks to Basile Starynkevitch for the suggestion and initial patch.
Thanks to Jonathan Landis and Deron Meranda for showing how this can
be utilized for implementing secure memory operations.
2011-02-17 10:10:53 +02:00
Petri Lehtinen
fa7c2ea070
Update copyright notices for 2011
2011-01-22 13:43:14 +02:00
Petri Lehtinen
976fc2279f
Replace all occurences of inline with JSON_INLINE
...
This makes it easier to compile without the configure script (e.g. on
Windows).
2010-09-05 21:18:46 +03:00
Petri Lehtinen
68f2861e92
Unify unsigned integer usage in the API
...
Replace all occurences of unsigned int and unsigned long with size_t.
This is a backwards incompatible change, as the signature of many API
functions changes.
2010-06-15 15:38:59 +03:00
Petri Lehtinen
4e63fcd55d
Merge branch '1.2'
...
Conflicts:
configure.ac
2010-03-28 21:44:41 +03:00
Petri Lehtinen
29ee3832cf
Support compilers that don't have the "inline" keyword
...
Use AC_C_INLINE autoconf macro, include config.h where needed, and add
a define of JSON_INLINE to jansson.h that has the correct "inline"
keyword.
2010-03-28 21:14:08 +03:00
Petri Lehtinen
307167fb66
Optimize hashtable_set()
...
If a key already exists in the hashtable, use the existing pair
changing its value instead of removing the old one and allocating a
new pair.
2010-02-09 20:51:25 +02:00
Petri Lehtinen
8d75235ff2
Merge branch '1.2'
...
Conflicts:
LICENSE
2010-02-04 21:13:57 +02:00
Petri Lehtinen
08dc8d9baf
Add year 2010 to copyright notices
2010-02-02 21:26:11 +02:00
Petri Lehtinen
b495b96547
Add functions json_object_iter_{at,set,set_new}
2010-02-01 21:07:19 +02:00
Petri Lehtinen
1e00cd58a5
Extend object API
...
Added functions:
json_object_size
json_object_clear
json_object_update
2009-10-11 20:44:01 +03:00
Petri Lehtinen
61d0111323
Bump hashtable, allocate object->hashtable statically
...
Hashtable code from git://github.com/akheron/hashtable.git commit
7331ba6acdb415a2af62ae3e93fdd39c2a83b768
2009-05-12 21:44:45 +03:00
Petri Lehtinen
17a69c2d66
Initial import
2009-05-12 21:44:01 +03:00