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

Function ChildArgsChanged

extern/re2/re2/simplify.cc:204–216  ·  view source on GitHub ↗

Utility function for PostVisit implementations that compares re->sub() with child_args to determine whether any child_args changed. In the common case, where nothing changed, calls Decref() for all child_args and returns false, so PostVisit must return re->Incref(). Otherwise, returns true.

Source from the content-addressed store, hash-verified

202// where nothing changed, calls Decref() for all child_args and returns false,
203// so PostVisit must return re->Incref(). Otherwise, returns true.
204static bool ChildArgsChanged(Regexp* re, Regexp** child_args) {
205 for (int i = 0; i < re->nsub(); i++) {
206 Regexp* sub = re->sub()[i];
207 Regexp* newsub = child_args[i];
208 if (newsub != sub)
209 return true;
210 }
211 for (int i = 0; i < re->nsub(); i++) {
212 Regexp* newsub = child_args[i];
213 newsub->Decref();
214 }
215 return false;
216}
217
218Regexp* CoalesceWalker::Copy(Regexp* re) {
219 return re->Incref();

Callers 1

PostVisitMethod · 0.85

Calls 3

nsubMethod · 0.80
subMethod · 0.45
DecrefMethod · 0.45

Tested by

no test coverage detected