mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 959485, part 1 - Remove null checks of the result of new nsJS*ID. r=gabor
This commit is contained in:
parent
57b34ac824
commit
b6a2f503ca
@ -173,11 +173,9 @@ nsJSID::NewID(const char* str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsJSID* idObj = new nsJSID();
|
nsJSID* idObj = new nsJSID();
|
||||||
if (idObj) {
|
NS_ADDREF(idObj);
|
||||||
NS_ADDREF(idObj);
|
if (NS_FAILED(idObj->Initialize(str)))
|
||||||
if (NS_FAILED(idObj->Initialize(str)))
|
NS_RELEASE(idObj);
|
||||||
NS_RELEASE(idObj);
|
|
||||||
}
|
|
||||||
return idObj;
|
return idObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,12 +184,10 @@ nsJSID*
|
|||||||
nsJSID::NewID(const nsID& id)
|
nsJSID::NewID(const nsID& id)
|
||||||
{
|
{
|
||||||
nsJSID* idObj = new nsJSID();
|
nsJSID* idObj = new nsJSID();
|
||||||
if (idObj) {
|
NS_ADDREF(idObj);
|
||||||
NS_ADDREF(idObj);
|
idObj->mID = id;
|
||||||
idObj->mID = id;
|
idObj->mName = nullptr;
|
||||||
idObj->mName = nullptr;
|
idObj->mNumber = nullptr;
|
||||||
idObj->mNumber = nullptr;
|
|
||||||
}
|
|
||||||
return idObj;
|
return idObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,27 +621,25 @@ nsJSCID::NewID(const char* str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsJSCID* idObj = new nsJSCID();
|
nsJSCID* idObj = new nsJSCID();
|
||||||
if (idObj) {
|
bool success = false;
|
||||||
bool success = false;
|
NS_ADDREF(idObj);
|
||||||
NS_ADDREF(idObj);
|
|
||||||
|
|
||||||
if (str[0] == '{') {
|
if (str[0] == '{') {
|
||||||
if (NS_SUCCEEDED(idObj->Initialize(str)))
|
if (NS_SUCCEEDED(idObj->Initialize(str)))
|
||||||
success = true;
|
success = true;
|
||||||
} else {
|
} else {
|
||||||
nsCOMPtr<nsIComponentRegistrar> registrar;
|
nsCOMPtr<nsIComponentRegistrar> registrar;
|
||||||
NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
NS_GetComponentRegistrar(getter_AddRefs(registrar));
|
||||||
if (registrar) {
|
if (registrar) {
|
||||||
nsCID *cid;
|
nsCID *cid;
|
||||||
if (NS_SUCCEEDED(registrar->ContractIDToCID(str, &cid))) {
|
if (NS_SUCCEEDED(registrar->ContractIDToCID(str, &cid))) {
|
||||||
success = idObj->mDetails.InitWithName(*cid, str);
|
success = idObj->mDetails.InitWithName(*cid, str);
|
||||||
nsMemory::Free(cid);
|
nsMemory::Free(cid);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!success)
|
|
||||||
NS_RELEASE(idObj);
|
|
||||||
}
|
}
|
||||||
|
if (!success)
|
||||||
|
NS_RELEASE(idObj);
|
||||||
return idObj;
|
return idObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user