[poincare] Register Static Allocation Failure if required

This commit is contained in:
Émilie Feral
2018-08-09 16:43:36 +02:00
parent 8bfbad3f97
commit 5fd415eb9e
21 changed files with 26 additions and 7 deletions

View File

@@ -11,6 +11,7 @@ namespace Poincare {
AdditionNode * AdditionNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<AdditionNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -6,6 +6,7 @@ namespace Poincare {
CharLayoutNode * CharLayoutNode::FailedAllocationStaticNode() {
static AllocationFailureLayoutNode<CharLayoutNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -32,6 +32,7 @@ void DecimalNode::setValue(native_uint_t * mantissaDigits, size_t mantissaSize,
DecimalNode * DecimalNode::FailedAllocationStaticNode() {
static AllocationFailureDecimalNode failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -15,8 +15,9 @@ extern "C" {
namespace Poincare {
DivisionNode * FailedAllocationStaticNode() {
DivisionNode * DivisionNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<DivisionNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -5,6 +5,7 @@ namespace Poincare {
template<typename T> FloatNode<T> * FloatNode<T>::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<FloatNode<T>> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -12,6 +12,7 @@ static inline KDCoordinate max(KDCoordinate x, KDCoordinate y) { return x > y ?
FractionLayoutNode * FractionLayoutNode::FailedAllocationStaticNode() {
static AllocationFailureLayoutNode<FractionLayoutNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -3,9 +3,9 @@
namespace Poincare {
GhostNode * GhostNode::FailedAllocationStaticNode() {
static AllocationFailedGhostNode FailureNode;
TreePool::sharedPool()->registerStaticNodeIfRequired(&FailureNode);
return &FailureNode;
static AllocationFailedGhostNode failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}
}

View File

@@ -8,6 +8,7 @@ static inline KDCoordinate maxCoordinate(KDCoordinate c1, KDCoordinate c2) { ret
HorizontalLayoutNode * HorizontalLayoutNode::FailedAllocationStaticNode() {
static AllocationFailureLayoutNode<HorizontalLayoutNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -12,6 +12,7 @@ namespace Poincare {
InfinityNode * InfinityNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<InfinityNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -355,6 +355,7 @@ NaturalIntegerPointer::NaturalIntegerPointer(native_uint_t * buffer, size_t size
IntegerNode * IntegerNode::FailedAllocationStaticNode() {
static AllocationFailureIntegerNode failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -68,9 +68,9 @@ void LayoutNode::invalidAllSizesPositionsAndBaselines() {
// TreeNode
TreeNode * LayoutNode::FailedAllocationStaticNode() {
static AllocationFailedLayoutNode FailureNode;
TreePool::sharedPool()->registerStaticNodeIfRequired(&FailureNode);
return &FailureNode;
static AllocationFailedLayoutNode failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}
// Tree navigation

View File

@@ -12,6 +12,7 @@ namespace Poincare {
template<typename T>
MatrixComplexNode<T> * MatrixComplexNode<T>::FailedAllocationStaticNode() {
static AllocationFailureMatrixComplexNode<T> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -21,6 +21,7 @@ namespace Poincare {
MultiplicationNode * MultiplicationNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<MultiplicationNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -15,6 +15,7 @@ namespace Poincare {
OppositeNode * OppositeNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<OppositeNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -6,6 +6,7 @@ namespace Poincare {
ParenthesisNode * ParenthesisNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<ParenthesisNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -32,6 +32,7 @@ namespace Poincare {
PowerNode * PowerNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<PowerNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -24,6 +24,7 @@ void RationalNode::setDigits(native_uint_t * numeratorDigits, size_t numeratorSi
RationalNode * RationalNode::FailedAllocationStaticNode() {
static AllocationFailureRationalNode failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -11,6 +11,7 @@ namespace Poincare {
SubtractionNode * SubtractionNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<SubtractionNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -15,6 +15,7 @@ namespace Poincare {
SymbolNode * SymbolNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<SymbolNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -11,6 +11,7 @@ namespace Poincare {
UndefinedNode * UndefinedNode::FailedAllocationStaticNode() {
static AllocationFailureExpressionNode<UndefinedNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}

View File

@@ -11,6 +11,7 @@ namespace Poincare {
VerticalOffsetLayoutNode * VerticalOffsetLayoutNode::FailedAllocationStaticNode() {
static AllocationFailureLayoutNode<VerticalOffsetLayoutNode> failure;
TreePool::sharedPool()->registerStaticNodeIfRequired(&failure);
return &failure;
}