FileTypes: Avoid useless call to ReplaceRef
Don't replace the ref with itself in the most common case where the scanned file is not a symlink. Save a lot of useless memory copies and ref flattening in BMessage.
This commit is contained in:
@@ -238,7 +238,8 @@ FileTypes::RefsReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!is_application(file) && !is_resource(file)) {
|
if (!is_application(file) && !is_resource(file)) {
|
||||||
if (entry.GetRef(&ref) == B_OK)
|
entry_ref target;
|
||||||
|
if (entry.GetRef(&target) == B_OK && target != ref)
|
||||||
message->ReplaceRef("refs", index - 1, &ref);
|
message->ReplaceRef("refs", index - 1, &ref);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user