We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e83db1d commit 877e667Copy full SHA for 877e667
src/StringArray.h
@@ -60,23 +60,16 @@ class LinkedList {
60
};
61
62
void _remove(ItemType* pit, ItemType* it) {
63
- if(pit == nullptr){ // item is root
64
- _root = _root->next;
65
- if (_root == nullptr) {
66
- _last = nullptr;
67
- }
68
- } else {
69
- pit->next = it->next;
70
- if (it == _last) {
71
- _last = pit;
72
73
74
-
75
- if (_onRemove) {
76
- _onRemove(it->value());
77
78
79
- delete it;
+ auto* next = pit ? &pit->next : &_root;
+ *next = it->next;
+ if (_last == it) {
+ _last = pit;
+ }
+
+ if (_onRemove) {
+ _onRemove(it->value());
+ delete it;
80
}
81
82
public:
0 commit comments