| ceed-elemrestriction.c (78a97f55f6a0b493f351ed551b9ecfb9c33a05ae) | ceed-elemrestriction.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> --- 975 unchanged lines hidden (view full) --- 984 985 @param[in,out] rstr CeedElemRestriction to destroy 986 987 @return An error code: 0 - success, otherwise - failure 988 989 @ref User 990**/ 991int CeedElemRestrictionDestroy(CeedElemRestriction *rstr) { | 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> --- 975 unchanged lines hidden (view full) --- 984 985 @param[in,out] rstr CeedElemRestriction to destroy 986 987 @return An error code: 0 - success, otherwise - failure 988 989 @ref User 990**/ 991int CeedElemRestrictionDestroy(CeedElemRestriction *rstr) { |
| 992 if (!*rstr || --(*rstr)->ref_count > 0) return CEED_ERROR_SUCCESS; | 992 if (!*rstr || --(*rstr)->ref_count > 0) { 993 *rstr = NULL; 994 return CEED_ERROR_SUCCESS; 995 } |
| 993 if ((*rstr)->num_readers) { 994 // LCOV_EXCL_START 995 return CeedError((*rstr)->ceed, CEED_ERROR_ACCESS, "Cannot destroy CeedElemRestriction, a process has read access to the offset data"); 996 // LCOV_EXCL_STOP 997 } 998 if ((*rstr)->Destroy) CeedCall((*rstr)->Destroy(*rstr)); 999 CeedCall(CeedFree(&(*rstr)->strides)); 1000 CeedCall(CeedDestroy(&(*rstr)->ceed)); 1001 CeedCall(CeedFree(rstr)); 1002 return CEED_ERROR_SUCCESS; 1003} 1004 1005/// @} | 996 if ((*rstr)->num_readers) { 997 // LCOV_EXCL_START 998 return CeedError((*rstr)->ceed, CEED_ERROR_ACCESS, "Cannot destroy CeedElemRestriction, a process has read access to the offset data"); 999 // LCOV_EXCL_STOP 1000 } 1001 if ((*rstr)->Destroy) CeedCall((*rstr)->Destroy(*rstr)); 1002 CeedCall(CeedFree(&(*rstr)->strides)); 1003 CeedCall(CeedDestroy(&(*rstr)->ceed)); 1004 CeedCall(CeedFree(rstr)); 1005 return CEED_ERROR_SUCCESS; 1006} 1007 1008/// @} |