Skip to content

Commit

Permalink
use SUNCheck
Browse files Browse the repository at this point in the history
  • Loading branch information
balos1 committed Feb 11, 2025
1 parent 1a9869a commit b5b1385
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/sundials/sundials_datanode.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,20 @@ SUNErrCode SUNDataNode_CreateList(SUNDataIOMode io_mode,

SUNDIALS_MARK_FUNCTION_BEGIN(SUNCTX_->profiler);

SUNErrCode err = SUN_SUCCESS;
switch (io_mode)
{
case (SUNDATAIOMODE_INMEM):
SUNCheckCall(SUNDataNode_CreateList_InMem(num_elements, sunctx, node_out));
err = SUNDataNode_CreateList_InMem(num_elements, sunctx, node_out);
break;
default:
SUNDIALS_MARK_FUNCTION_END(SUNCTX_->profiler);
return SUN_ERR_ARG_OUTOFRANGE;
default: err = SUN_ERR_ARG_OUTOFRANGE;
}

SUNDIALS_MARK_FUNCTION_END(SUNCTX_->profiler);

return SUN_SUCCESS;
SUNCheck(err);

return err;
}

SUNErrCode SUNDataNode_CreateObject(SUNDataIOMode io_mode,
Expand All @@ -104,19 +105,20 @@ SUNErrCode SUNDataNode_CreateObject(SUNDataIOMode io_mode,

SUNDIALS_MARK_FUNCTION_BEGIN(SUNCTX_->profiler);

SUNErrCode err = SUN_SUCCESS;
switch (io_mode)
{
case (SUNDATAIOMODE_INMEM):
SUNCheckCall(SUNDataNode_CreateObject_InMem(num_elements, sunctx, node_out));
err = SUNDataNode_CreateObject_InMem(num_elements, sunctx, node_out);
break;
default:
SUNDIALS_MARK_FUNCTION_END(SUNCTX_->profiler);
return SUN_ERR_ARG_OUTOFRANGE;
default: err = SUN_ERR_ARG_OUTOFRANGE;
}

SUNDIALS_MARK_FUNCTION_END(SUNCTX_->profiler);

return SUN_SUCCESS;
SUNCheck(err);

return err;
}

SUNErrCode SUNDataNode_IsLeaf(const SUNDataNode self, sunbooleantype* yes_or_no)
Expand Down

0 comments on commit b5b1385

Please sign in to comment.