On a side note, what can we do about checking for unusually verbose or inefficient constructs? Examples:

static const PRUnichar* kResetBackupDirectory = NS_LITERAL_STRING("resetBackupDirectory").get();

This is technically incorrect on systems that don't support a 16-bit char type (short wchar_t or char16_t). (When can we require a real UTF16 type?)

nsString type = NS_LITERAL_STRING("npapi-carbon-event-model-failure");

This is very inefficient because the string gets copied into an allocated buffer. Both of the above could have either used NS_NAMED_LITERAL_STRING or been inlined into the single use.

nsCOMPtr<nsIVariant> d(already_AddRefed<nsIVariant>(XPCVariant::newVariant(ccx, v)));

We have a templated function that saves you from needlessly retyping the type:
nsCOMPtr<nsIVariant> d(dont_AddRef(XPCVariant::newVariant(ccx, v)));



_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to