MCPcopy Create free account
hub / github.com/FastLED/FastLED / grow

Method grow

src/fl/stl/detail/string_holder.cpp.hpp:43–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void StringHolder::grow(size newLength) {
44 if (newLength + 1 <= mCapacity) {
45 // We have enough capacity for newLength + null terminator
46 mLength = newLength;
47 mData[mLength] = '\0';
48 return;
49 }
50
51 // Use fl::realloc for efficient growth without memory move
52 // fl::realloc may expand in place or copy to larger block as needed
53 mData = (char*)fl::realloc(mData, newLength + 1);
54 mLength = newLength;
55 mCapacity = newLength + 1;
56 mData[mLength] = '\0'; // Ensure null-termination
57}
58
59} // namespace fl

Callers 1

writeMethod · 0.80

Calls 1

reallocFunction · 0.50

Tested by

no test coverage detected