ramfs: Optimize Volume::NodeAttributeRemoved() slightly.
Use the pointer to the Index stored with the Attribute rather than doing an unnecessary lookup. Also clean up code style.
This commit is contained in:
@@ -632,26 +632,23 @@ Volume::NodeAttributeAdded(ino_t id, Attribute *attribute)
|
||||
status_t
|
||||
Volume::NodeAttributeRemoved(ino_t id, Attribute *attribute)
|
||||
{
|
||||
status_t error = (attribute ? B_OK : B_BAD_VALUE);
|
||||
if (error == B_OK) {
|
||||
// notify the respective attribute index
|
||||
if (error == B_OK) {
|
||||
if (AttributeIndex *index = FindAttributeIndex(
|
||||
attribute->GetName(), attribute->GetType())) {
|
||||
index->Removed(attribute);
|
||||
}
|
||||
}
|
||||
if (attribute == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
// update live queries
|
||||
if (error == B_OK && attribute->GetNode()) {
|
||||
uint8 oldKey[kMaxIndexKeyLength];
|
||||
size_t oldLength;
|
||||
attribute->GetKey(oldKey, &oldLength);
|
||||
UpdateLiveQueries(NULL, attribute->GetNode(), attribute->GetName(),
|
||||
attribute->GetType(), oldKey, oldLength, NULL, 0);
|
||||
}
|
||||
// notify the attribute index
|
||||
if (AttributeIndex *index = attribute->GetIndex())
|
||||
index->Removed(attribute);
|
||||
|
||||
// update live queries
|
||||
if (attribute->GetNode() != NULL) {
|
||||
uint8 oldKey[kMaxIndexKeyLength];
|
||||
size_t oldLength;
|
||||
attribute->GetKey(oldKey, &oldLength);
|
||||
UpdateLiveQueries(NULL, attribute->GetNode(), attribute->GetName(),
|
||||
attribute->GetType(), oldKey, oldLength, NULL, 0);
|
||||
}
|
||||
return error;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user