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 @@ -134,8 +134,8 @@ class ResourceManager {
134134 StringNode::destroy (node, allocator_);
135135 }
136136
137- void dereferenceString (const char * s ) {
138- stringPool_.dereference (s , allocator_);
137+ void dereferenceString (StringNode* node ) {
138+ stringPool_.dereference (node , allocator_);
139139 }
140140
141141 SlotId saveStaticString (const char * s) {
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 @@ -531,7 +531,7 @@ class VariantImpl {
531531 return ;
532532
533533 if (data_->type & VariantTypeBits::OwnedStringBit)
534- resources_->dereferenceString (data_-> content . asOwnedString -> data );
534+ resources_->dereferenceString (asOwnedString () );
535535
536536#if ARDUINOJSON_USE_8_BYTE_POOL
537537 if (data_->type & VariantTypeBits::EightByteBit)
You can’t perform that action at this time.
0 commit comments