Deletes this object; ref count has count reached 0.
| 133 | |
| 134 | // Deletes this object; ref count has count reached 0. |
| 135 | void Regexp::Destroy() { |
| 136 | if (QuickDestroy()) |
| 137 | return; |
| 138 | |
| 139 | // Handle recursive Destroy with explicit stack |
| 140 | // to avoid arbitrarily deep recursion on process stack [sigh]. |
| 141 | down_ = NULL; |
| 142 | Regexp* stack = this; |
| 143 | while (stack != NULL) { |
| 144 | Regexp* re = stack; |
| 145 | stack = re->down_; |
| 146 | if (re->ref_ != 0) |
| 147 | LOG(DFATAL) << "Bad reference count " << re->ref_; |
| 148 | if (re->nsub_ > 0) { |
| 149 | Regexp** subs = re->sub(); |
| 150 | for (int i = 0; i < re->nsub_; i++) { |
| 151 | Regexp* sub = subs[i]; |
| 152 | if (sub == NULL) |
| 153 | continue; |
| 154 | if (sub->ref_ == kMaxRef) |
| 155 | sub->Decref(); |
| 156 | else |
| 157 | --sub->ref_; |
| 158 | if (sub->ref_ == 0 && !sub->QuickDestroy()) { |
| 159 | sub->down_ = stack; |
| 160 | stack = sub; |
| 161 | } |
| 162 | } |
| 163 | if (re->nsub_ > 1) |
| 164 | delete[] subs; |
| 165 | re->nsub_ = 0; |
| 166 | } |
| 167 | delete re; |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | void Regexp::AddRuneToString(Rune r) { |
| 172 | DCHECK(op_ == kRegexpLiteralString); |
nothing calls this directly
no test coverage detected