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:
Adrien Destugues 2014-12-24 11:49:31 +01:00
parent a6f1bc984d
commit 234ac3f191

View File

@ -238,7 +238,8 @@ FileTypes::RefsReceived(BMessage* message)
}
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);
continue;
}