зеркало из https://github.com/mozilla/gecko-dev.git
Bug 616774 followup: Remove nullchecks after new that are no longer needed. r=sicking
This commit is contained in:
Родитель
6ce2c86bc0
Коммит
b8b095aa24
|
@ -113,7 +113,6 @@ txExprParser::createAVT(const nsSubstring& aAttrValue,
|
||||||
}
|
}
|
||||||
newExpr = new txLiteralExpr(literalString +
|
newExpr = new txLiteralExpr(literalString +
|
||||||
Substring(start, iter));
|
Substring(start, iter));
|
||||||
NS_ENSURE_TRUE(newExpr, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Parse expressions, iter is already past the initial '{' when
|
// Parse expressions, iter is already past the initial '{' when
|
||||||
|
@ -171,7 +170,6 @@ txExprParser::createAVT(const nsSubstring& aAttrValue,
|
||||||
|
|
||||||
if (!expr) {
|
if (!expr) {
|
||||||
expr = new txLiteralExpr(EmptyString());
|
expr = new txLiteralExpr(EmptyString());
|
||||||
NS_ENSURE_TRUE(expr, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*aResult = expr.forget();
|
*aResult = expr.forget();
|
||||||
|
@ -405,7 +403,6 @@ txExprParser::createFilterOrStep(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
nspace);
|
nspace);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
expr = new VariableRefExpr(prefix, lName, nspace);
|
expr = new VariableRefExpr(prefix, lName, nspace);
|
||||||
NS_ENSURE_TRUE(expr, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Token::L_PAREN:
|
case Token::L_PAREN:
|
||||||
|
@ -419,12 +416,10 @@ txExprParser::createFilterOrStep(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
break;
|
break;
|
||||||
case Token::LITERAL :
|
case Token::LITERAL :
|
||||||
expr = new txLiteralExpr(tok->Value());
|
expr = new txLiteralExpr(tok->Value());
|
||||||
NS_ENSURE_TRUE(expr, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
break;
|
break;
|
||||||
case Token::NUMBER:
|
case Token::NUMBER:
|
||||||
{
|
{
|
||||||
expr = new txLiteralExpr(Double::toDouble(tok->Value()));
|
expr = new txLiteralExpr(Double::toDouble(tok->Value()));
|
||||||
NS_ENSURE_TRUE(expr, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -434,7 +429,6 @@ txExprParser::createFilterOrStep(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
|
|
||||||
if (lexer.peek()->mType == Token::L_BRACKET) {
|
if (lexer.peek()->mType == Token::L_BRACKET) {
|
||||||
nsAutoPtr<FilterExpr> filterExpr(new FilterExpr(expr));
|
nsAutoPtr<FilterExpr> filterExpr(new FilterExpr(expr));
|
||||||
NS_ENSURE_TRUE(filterExpr, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
expr.forget();
|
expr.forget();
|
||||||
|
|
||||||
|
@ -472,7 +466,6 @@ txExprParser::createFunctionCall(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
txCoreFunctionCall::getTypeFromAtom(lName, type)) {
|
txCoreFunctionCall::getTypeFromAtom(lName, type)) {
|
||||||
// It is a known built-in function.
|
// It is a known built-in function.
|
||||||
fnCall = new txCoreFunctionCall(type);
|
fnCall = new txCoreFunctionCall(type);
|
||||||
NS_ENSURE_TRUE(fnCall, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// check extension functions and xslt
|
// check extension functions and xslt
|
||||||
|
@ -488,7 +481,6 @@ txExprParser::createFunctionCall(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
|
|
||||||
*aResult = new txLiteralExpr(tok->Value() +
|
*aResult = new txLiteralExpr(tok->Value() +
|
||||||
NS_LITERAL_STRING(" not implemented."));
|
NS_LITERAL_STRING(" not implemented."));
|
||||||
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -576,14 +568,12 @@ txExprParser::createLocationStep(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
lexer.nextToken();
|
lexer.nextToken();
|
||||||
axisIdentifier = LocationStep::PARENT_AXIS;
|
axisIdentifier = LocationStep::PARENT_AXIS;
|
||||||
nodeTest = new txNodeTypeTest(txNodeTypeTest::NODE_TYPE);
|
nodeTest = new txNodeTypeTest(txNodeTypeTest::NODE_TYPE);
|
||||||
NS_ENSURE_TRUE(nodeTest, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
break;
|
break;
|
||||||
case Token::SELF_NODE :
|
case Token::SELF_NODE :
|
||||||
//-- eat token
|
//-- eat token
|
||||||
lexer.nextToken();
|
lexer.nextToken();
|
||||||
axisIdentifier = LocationStep::SELF_AXIS;
|
axisIdentifier = LocationStep::SELF_AXIS;
|
||||||
nodeTest = new txNodeTypeTest(txNodeTypeTest::NODE_TYPE);
|
nodeTest = new txNodeTypeTest(txNodeTypeTest::NODE_TYPE);
|
||||||
NS_ENSURE_TRUE(nodeTest, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -608,7 +598,6 @@ txExprParser::createLocationStep(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
axisIdentifier == LocationStep::ATTRIBUTE_AXIS ?
|
axisIdentifier == LocationStep::ATTRIBUTE_AXIS ?
|
||||||
static_cast<PRUint16>(txXPathNodeType::ATTRIBUTE_NODE) :
|
static_cast<PRUint16>(txXPathNodeType::ATTRIBUTE_NODE) :
|
||||||
static_cast<PRUint16>(txXPathNodeType::ELEMENT_NODE));
|
static_cast<PRUint16>(txXPathNodeType::ELEMENT_NODE));
|
||||||
NS_ENSURE_TRUE(nodeTest, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lexer.pushBack();
|
lexer.pushBack();
|
||||||
|
@ -618,7 +607,6 @@ txExprParser::createLocationStep(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoPtr<LocationStep> lstep(new LocationStep(nodeTest, axisIdentifier));
|
nsAutoPtr<LocationStep> lstep(new LocationStep(nodeTest, axisIdentifier));
|
||||||
NS_ENSURE_TRUE(lstep, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
nodeTest.forget();
|
nodeTest.forget();
|
||||||
|
|
||||||
|
@ -694,7 +682,6 @@ txExprParser::createPathExpr(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
lexer.nextToken();
|
lexer.nextToken();
|
||||||
if (!isLocationStepToken(lexer.peek())) {
|
if (!isLocationStepToken(lexer.peek())) {
|
||||||
*aResult = new RootExpr();
|
*aResult = new RootExpr();
|
||||||
NS_ENSURE_TRUE(*aResult, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
lexer.pushBack();
|
lexer.pushBack();
|
||||||
|
@ -717,7 +704,6 @@ txExprParser::createPathExpr(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
expr = new RootExpr();
|
expr = new RootExpr();
|
||||||
NS_ENSURE_TRUE(expr, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
#ifdef TX_TO_STRING
|
#ifdef TX_TO_STRING
|
||||||
static_cast<RootExpr*>(expr.get())->setSerialize(false);
|
static_cast<RootExpr*>(expr.get())->setSerialize(false);
|
||||||
|
@ -726,7 +712,6 @@ txExprParser::createPathExpr(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
|
|
||||||
// We have a PathExpr containing several steps
|
// We have a PathExpr containing several steps
|
||||||
nsAutoPtr<PathExpr> pathExpr(new PathExpr());
|
nsAutoPtr<PathExpr> pathExpr(new PathExpr());
|
||||||
NS_ENSURE_TRUE(pathExpr, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
rv = pathExpr->addExpr(expr, PathExpr::RELATIVE_OP);
|
rv = pathExpr->addExpr(expr, PathExpr::RELATIVE_OP);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -782,7 +767,6 @@ txExprParser::createUnionExpr(txExprLexer& lexer, txIParseContext* aContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoPtr<UnionExpr> unionExpr(new UnionExpr());
|
nsAutoPtr<UnionExpr> unionExpr(new UnionExpr());
|
||||||
NS_ENSURE_TRUE(unionExpr, NS_ERROR_OUT_OF_MEMORY);
|
|
||||||
|
|
||||||
rv = unionExpr->addExpr(expr);
|
rv = unionExpr->addExpr(expr);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче