| ceed-tensor.c (78a97f55f6a0b493f351ed551b9ecfb9c33a05ae) | ceed-tensor.c (ad6481ce28fcfada16ee6d8a13bbacd137fe686a) |
|---|---|
| 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include <ceed-impl.h> --- 136 unchanged lines hidden (view full) --- 145 146 @param[in,out] contract CeedTensorContract to destroy 147 148 @return An error code: 0 - success, otherwise - failure 149 150 @ref Backend 151**/ 152int CeedTensorContractDestroy(CeedTensorContract *contract) { | 1// Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors. 2// All Rights Reserved. See the top-level LICENSE and NOTICE files for details. 3// 4// SPDX-License-Identifier: BSD-2-Clause 5// 6// This file is part of CEED: http://github.com/ceed 7 8#include <ceed-impl.h> --- 136 unchanged lines hidden (view full) --- 145 146 @param[in,out] contract CeedTensorContract to destroy 147 148 @return An error code: 0 - success, otherwise - failure 149 150 @ref Backend 151**/ 152int CeedTensorContractDestroy(CeedTensorContract *contract) { |
| 153 if (!*contract || --(*contract)->ref_count > 0) return CEED_ERROR_SUCCESS; | 153 if (!*contract || --(*contract)->ref_count > 0) { 154 *contract = NULL; 155 return CEED_ERROR_SUCCESS; 156 } |
| 154 if ((*contract)->Destroy) { 155 CeedCall((*contract)->Destroy(*contract)); 156 } 157 CeedCall(CeedDestroy(&(*contract)->ceed)); 158 CeedCall(CeedFree(contract)); 159 return CEED_ERROR_SUCCESS; 160} 161 162/// @} | 157 if ((*contract)->Destroy) { 158 CeedCall((*contract)->Destroy(*contract)); 159 } 160 CeedCall(CeedDestroy(&(*contract)->ceed)); 161 CeedCall(CeedFree(contract)); 162 return CEED_ERROR_SUCCESS; 163} 164 165/// @} |