MCPcopy Create free account
hub / github.com/bblanchon/ArduinoJson / create

Function create

src/ArduinoJson/Memory/StringNode.hpp:35–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33 }
34
35 static StringNode* create(size_t length, Allocator* allocator) {
36 if (length > maxLength)
37 return nullptr;
38 auto size = sizeForLength(length);
39 if (size < length) // integer overflow
40 return nullptr; // (not testable on 64-bit)
41 auto node = reinterpret_cast<StringNode*>(allocator->allocate(size));
42 if (node) {
43 node->length = length_type(length);
44 node->references = 1;
45 }
46 return node;
47 }
48
49 static StringNode* resize(StringNode* node, size_t length,
50 Allocator* allocator) {

Callers 2

createStringMethod · 0.85
addFunction · 0.85

Calls 2

sizeForLengthFunction · 0.85
allocateMethod · 0.45

Tested by

no test coverage detected