Commit Graph

106 Commits

Author SHA1 Message Date
Benoit Blanchon
cc077c1b63 Store static strings in a dedicated pool
Because a slot id is smaller than a pointer, this change will ultimately allow reducing the slot size.
2025-07-10 19:17:13 +02:00
Benoit Blanchon
411424b74e CI: upgrade clang-tidy 2025-05-20 20:55:01 +02:00
Benoit Blanchon
deab127a2f Fix crash with tiny Flash strings (issue #2170) 2025-04-11 10:23:43 +02:00
Benoit Blanchon
01e49b33b7 Update copyright year 2025-02-24 15:18:26 +01:00
Benoit Blanchon
594dc707cb Change string copy policy: only string literal are stored by pointer 2024-11-25 12:25:59 +01:00
Benoit Blanchon
57a9c50b38 Make ElementProxy and MemberProxy non-copyable 2024-11-25 10:46:21 +01:00
Benoit Blanchon
5e7653b36a Store adapted string in MemberProxy 2024-11-17 15:46:46 +01:00
Benoit Blanchon
e007d71b4f Fix operator[](variant) ignoring NUL characters 2024-11-14 14:56:47 +01:00
Benoit Blanchon
31253dbe13 Add more tests with VLAs 2024-11-08 09:37:49 +01:00
Benoit Blanchon
1110d62128 Fix VLA support in JsonDocument::set() 2024-11-08 09:37:23 +01:00
Benoit Blanchon
c6c0649d70 Replace typedef with using 2024-10-23 15:54:08 +02:00
Benoit Blanchon
d92eee8736 Deprecate containsKey() in favor of doc["key"].is<T>()
See #2121
2024-09-06 17:32:09 +02:00
Benoit Blanchon
09c89dcacf Store object members with two slots: one for the key and one for the value 2024-08-24 10:45:51 +02:00
Benoit Blanchon
386105be90 Allocate slot before key 2024-08-23 15:27:46 +02:00
Benoit Blanchon
45611924f3 Tests: add user-defined literal ""_s for std::string 2024-06-07 09:35:45 +02:00
Benoit Blanchon
5a60c55be7 Don't add partial objects when allocation fails
Fixes #2081
2024-05-23 18:36:24 +02:00
Benoit Blanchon
aeb30ef307 Support ElementProxy and MemberProxy in JsonDocument's constructor 2024-05-15 13:37:33 +02:00
Benoit Blanchon
1c5e5db071 Test JsonDocument constructor with a JsonVariantConst argument
See #2091
2024-05-15 09:30:22 +02:00
Benoit Blanchon
68a13117dc Allow using a JsonVariant as a key or index
Closes #2080
2024-05-14 21:06:02 +02:00
Benoit Blanchon
1b143d383b Fix assertion poolIndex < count_ after JsonDocument::clear()
Fixes #2034
2024-01-16 10:10:43 +01:00
Benoit Blanchon
0e8a236583 Update copyright year 2024-01-03 08:47:06 +01:00
Benoit Blanchon
6fe4b9c01d Detect string length overflows 2023-10-09 14:15:55 +02:00
Benoit Blanchon
c98ba999af Add more tests of JsonDocument constructor 2023-08-10 14:30:50 +02:00
Benoit Blanchon
7f459adc4b Remove createNestedArray() and createNestedObject() 2023-08-09 12:08:21 +02:00
Benoit Blanchon
f422b7b37d Replace add() with add<T>() (add(T) is still supported) 2023-08-09 10:57:52 +02:00
Benoit Blanchon
9a11d98117 Tests: make allocator assertions more readable 2023-07-26 09:28:21 +02:00
Benoit Blanchon
30ec507989 Tests: use a consistent naming convention for allocators 2023-07-25 14:53:54 +02:00
Benoit Blanchon
7a76da3bc7 Tests: rename ControllableAllocator to KillswitchAllocator 2023-07-25 14:46:25 +02:00
Benoit Blanchon
a8329564e2 Remove JsonDocument::garbageCollect() 2023-07-25 14:37:25 +02:00
Benoit Blanchon
00c9d8680a Remove memoryUsage() 2023-07-24 17:21:25 +02:00
Benoit Blanchon
1a14499612 Preallocate pool list 2023-07-21 17:57:13 +02:00
Benoit Blanchon
0f319e7ca4 Remove capacity from JsonDocument's constructor 2023-07-18 09:08:55 +02:00
Benoit Blanchon
42b2840009 Create more memory pools as needed (resolves #1074) 2023-07-18 09:08:55 +02:00
Benoit Blanchon
65c67d317a AllocatorLog: support nulls in deallocate() and reallocate() 2023-07-17 17:28:49 +02:00
Benoit Blanchon
c4e5051a7a Store index of slot in the pool instead of a pointer or a distance 2023-07-17 11:20:46 +02:00
Benoit Blanchon
39e8b63746 Remove shallowCopy() 2023-07-17 11:20:46 +02:00
Benoit Blanchon
c37990d791 CollectionData: addSlot() returns an iterator 2023-07-17 11:20:46 +02:00
Benoit Blanchon
0f511b873d VariantPool: store VariantSlots instead of chars 2023-07-12 15:03:56 +02:00
Benoit Blanchon
86772d33bc Rename VALUE_IS_OWNED_RAW to VALUE_IS_RAW_STRING 2023-05-02 10:03:37 +02:00
Benoit Blanchon
806fa907ab Always store serialized("string") by copy (#1915) 2023-05-02 09:36:40 +02:00
Benoit Blanchon
461cdaa818 Allow using PROGMEM outside of Arduino (fixes #1903)
Ported from 40daf56b5a
2023-04-21 19:08:53 +02:00
Benoit Blanchon
003087406c Reference-count shared strings 2023-04-21 16:11:54 +02:00
Benoit Blanchon
b7c8e0d25c Decouple VariantData from MemoryPool 2023-04-21 16:11:54 +02:00
Benoit Blanchon
d8f3058efa Store the strings in the heap 2023-04-17 10:42:08 +02:00
Benoit Blanchon
22e4f216c3 Tests: allow ArmoredAllocator to be called multiple times 2023-04-07 18:27:38 +02:00
Benoit Blanchon
e9850152a7 Tests: replace constants with sizeofString(n) 2023-04-07 14:50:54 +02:00
Benoit Blanchon
c4b879645a Remove JsonDocument::capacity() 2023-04-03 09:51:43 +02:00
Benoit Blanchon
0643c2e708 Test: gather JsonDocument constructor and assignment tests 2023-04-03 09:51:09 +02:00
Benoit Blanchon
bcf1339e89 Test: split JsonDocument.cpp into multiple files 2023-04-03 09:51:09 +02:00
Benoit Blanchon
dc463a2f72 Test: remove REQUIRE_JSON() 2023-04-03 09:51:09 +02:00