MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / Destroy

Method Destroy

extern/re2/re2/regexp.cc:135–169  ·  view source on GitHub ↗

Deletes this object; ref count has count reached 0.

Source from the content-addressed store, hash-verified

133
134// Deletes this object; ref count has count reached 0.
135void 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
171void Regexp::AddRuneToString(Rune r) {
172 DCHECK(op_ == kRegexpLiteralString);

Callers

nothing calls this directly

Calls 3

QuickDestroyMethod · 0.80
subMethod · 0.45
DecrefMethod · 0.45

Tested by

no test coverage detected