Bug 1142503 - don't use QueryInterface when the compiler can do the cast for us; r=ehsan
Calling QueryInterface with a statically known IID should typically not be necessary. In those cases where it's not, the compiler can do the cast for us, though we have to supply the reference-counting that QueryInterface would do. In passing, several redundant null-checks for the result of |new T| have been deleted.
This commit is contained in:
@@ -385,9 +385,7 @@ nsComposerCommandsUpdater::Notify(nsITimer *timer)
|
||||
nsresult
|
||||
NS_NewComposerCommandsUpdater(nsISelectionListener** aInstancePtrResult)
|
||||
{
|
||||
nsComposerCommandsUpdater* newThang = new nsComposerCommandsUpdater;
|
||||
NS_ENSURE_TRUE(newThang, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return newThang->QueryInterface(NS_GET_IID(nsISelectionListener),
|
||||
(void **)aInstancePtrResult);
|
||||
nsRefPtr<nsComposerCommandsUpdater> newThang = new nsComposerCommandsUpdater;
|
||||
newThang.forget(aInstancePtrResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user