示例#1
0
ListHookedDevice::Item*
ListHookedDevice::get_replaced(void) {
  // ----------------------------------------------------------------------
  // Search a last_ device first.
  ListHookedDevice::Item* p = get(last_);
  if (p && p->isReplaced()) return p;

  // ----------------------------------------------------------------------
  // Using a first matched device.
  for (p = static_cast<Item*>(list_.safe_front()); p; p = static_cast<Item*>(p->getnext())) {
    if (p->isReplaced()) return p;
  }

  return nullptr;
}
  ListHookedDevice::Item*
  ListHookedDevice::get_replaced(void)
  {
    if (! list_) return NULL;

    // ----------------------------------------------------------------------
    // Search a replaced device first.
    ListHookedDevice::Item* p = get(last_);
    if (p && p->isReplaced()) return p;

    for (p = static_cast<Item*>(list_->front()); p; p = static_cast<Item*>(p->getnext())) {
      if (p->isReplaced()) return p;
    }

    return NULL;
  }