Skip to content

Commit 44236c0

Browse files
committed
Hunting down the last useless calls to set_is_malloc_allowed
1 parent 58403cb commit 44236c0

2 files changed

Lines changed: 4 additions & 14 deletions

File tree

include/roboptim/core/sum-of-c1-squares.hxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ namespace roboptim {
6262
void GenericSumOfC1Squares<T>::
6363
impl_compute(result_ref result, const_argument_ref x) const
6464
{
65-
#ifndef ROBOPTIM_DO_NOT_CHECK_ALLOCATION
66-
set_is_malloc_allowed (true);
67-
#endif //! ROBOPTIM_DO_NOT_CHECK_ALLOCATION
68-
6965
computeFunction (x);
7066
value_type sumSquares = 0;
7167
for (typename result_t::Index i = 0; i < value_.size(); i++) {
@@ -80,10 +76,6 @@ namespace roboptim {
8076
impl_gradient(gradient_ref gradient, const_argument_ref x,
8177
size_type ROBOPTIM_DEBUG_ONLY (row)) const
8278
{
83-
#ifndef ROBOPTIM_DO_NOT_CHECK_ALLOCATION
84-
set_is_malloc_allowed (true);
85-
#endif //! ROBOPTIM_DO_NOT_CHECK_ALLOCATION
86-
8779
assert (row == 0);
8880
computeFunction (x);
8981
gradient.setZero ();

tests/sum-of-c1-squares.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,10 @@ BOOST_AUTO_TEST_CASE (sum_of_c1_squares)
6565
boost::shared_ptr<boost::test_tools::output_test_stream>
6666
output = retrievePattern ("sum-of-c1-squares");
6767

68-
Null null;
69-
NoTitle notitle;
7068
boost::shared_ptr<Null> Nullptr =
71-
boost::make_shared<Null>(null);
69+
boost::make_shared<Null>();
7270
boost::shared_ptr<NoTitle> NoTitleptr =
73-
boost::make_shared<NoTitle>(notitle);
71+
boost::make_shared<NoTitle>();
7472

7573
SumOfC1Squares NullSum(Nullptr, "null");
7674
SumOfC1Squares NoTitleSum(NoTitleptr, "no title");
@@ -91,8 +89,8 @@ BOOST_AUTO_TEST_CASE (sum_of_c1_squares)
9189
(*output) << NullSum.getName () << std::endl
9290
<< NoTitleSum.getName () << std::endl;
9391

94-
(*output) << NullSum.isValidResult (null (x)) << std::endl
95-
<< NoTitleSum.isValidResult (notitle (x)) << std::endl;
92+
(*output) << NullSum.isValidResult (NullSum (x)) << std::endl
93+
<< NoTitleSum.isValidResult (NoTitleSum (x)) << std::endl;
9694

9795
(*output) << NullSum (x) << std::endl
9896
<< NoTitleSum (x) << std::endl;

0 commit comments

Comments
 (0)