File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed
Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,8 @@ class ResourceManager {
132132 StringNode::destroy (node, allocator_);
133133 }
134134
135- void dereferenceString (const char * s ) {
136- stringPool_.dereference (s , allocator_);
135+ void dereferenceString (StringNode* node ) {
136+ stringPool_.dereference (node , allocator_);
137137 }
138138
139139 void clear () {
Original file line number Diff line number Diff line change @@ -78,20 +78,20 @@ class StringPool {
7878 return nullptr ;
7979 }
8080
81- void dereference (const char * s , Allocator* allocator) {
81+ void dereference (StringNode* nodeToRemove , Allocator* allocator) {
8282 StringNode* prev = nullptr ;
83- for (auto node = strings_; node; node = node ->next ) {
84- if (node-> data == s ) {
85- if (--node ->references == 0 ) {
83+ for (auto current = strings_; current; current = current ->next ) {
84+ if (current == nodeToRemove ) {
85+ if (--current ->references == 0 ) {
8686 if (prev)
87- prev->next = node ->next ;
87+ prev->next = current ->next ;
8888 else
89- strings_ = node ->next ;
90- StringNode::destroy (node , allocator);
89+ strings_ = current ->next ;
90+ StringNode::destroy (current , allocator);
9191 }
9292 return ;
9393 }
94- prev = node ;
94+ prev = current ;
9595 }
9696 }
9797
Original file line number Diff line number Diff line change @@ -499,7 +499,7 @@ class VariantImpl {
499499 return ;
500500
501501 if (data_->type & VariantTypeBits::OwnedStringBit)
502- resources_->dereferenceString (data_-> content . asStringNode -> data );
502+ resources_->dereferenceString (asStringNode () );
503503
504504#if ARDUINOJSON_USE_8_BYTE_POOL
505505 if (data_->type & VariantTypeBits::EightByteBit)
You can’t perform that action at this time.
0 commit comments