本文整理汇总了C++中BPartition::_RemoveObsoleteDescendants方法的典型用法代码示例。如果您正苦于以下问题:C++ BPartition::_RemoveObsoleteDescendants方法的具体用法?C++ BPartition::_RemoveObsoleteDescendants怎么用?C++ BPartition::_RemoveObsoleteDescendants使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BPartition
的用法示例。
在下文中一共展示了BPartition::_RemoveObsoleteDescendants方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CountChildren
// _RemoveObsoleteDescendants
status_t
BPartition::_RemoveObsoleteDescendants(user_partition_data* data, bool* updated)
{
// remove all children not longer persistent
// Not exactly efficient: O(n^2), considering BList::RemoveItem()
// O(1). We could do better (O(n*log(n))), when sorting the arrays before,
// but then the list access is more random and we had to find the
// BPartition to remove, which makes the list operation definitely O(n).
int32 count = CountChildren();
for (int32 i = count - 1; i >= 0; i--) {
BPartition* child = ChildAt(i);
bool found = false;
for (int32 k = data->child_count - 1; k >= 0; k--) {
if (data->children[k]->id == child->ID()) {
// found partition: ask it to remove its obsolete descendants
found = true;
status_t error = child->_RemoveObsoleteDescendants(
data->children[k], updated);
if (error != B_OK)
return error;
// set the user data to the BPartition object to find it
// quicker later
data->children[k]->user_data = child;
break;
}
}
// if partition is obsolete, remove it
if (!found) {
*updated = true;
_RemoveChild(i);
}
}
return B_OK;
}