- // In what follows, we look whether we find an active label
- // with the given string in the cache. If so, return its
- // references cache. If we only find an inactive one, return
- // that (the last we find, coincidentally). If we find nothing,
- // return an empty references cache.
- static LabelInfo linfo;
- linfo.inset = nullptr;
- linfo.references = References();
- linfo.active = false;
- bool have_inactive = false;
- for (auto & rc : d->ref_cache_) {
- if (rc.label == label) {
- if (rc.active)
- return rc.references;
- else {
- linfo = rc;
- have_inactive = true;
- }
- }
- }
-
- if (!have_inactive)
- // We found nothing, so insert the empty one to the cache
- // for further processing
- d->ref_cache_.push_back(linfo);