ceed-qfunctioncontext.c (1f61f64993e6b4788d7c005341bf8abd621cf78c) ceed-qfunctioncontext.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>

--- 928 unchanged lines hidden (view full) ---

937
938 @param[in,out] ctx CeedQFunctionContext to destroy
939
940 @return An error code: 0 - success, otherwise - failure
941
942 @ref User
943**/
944int CeedQFunctionContextDestroy(CeedQFunctionContext *ctx) {
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>

--- 928 unchanged lines hidden (view full) ---

937
938 @param[in,out] ctx CeedQFunctionContext to destroy
939
940 @return An error code: 0 - success, otherwise - failure
941
942 @ref User
943**/
944int CeedQFunctionContextDestroy(CeedQFunctionContext *ctx) {
945 if (!*ctx || --(*ctx)->ref_count > 0) return CEED_ERROR_SUCCESS;
946
945 if (!*ctx || --(*ctx)->ref_count > 0) {
946 *ctx = NULL;
947 return CEED_ERROR_SUCCESS;
948 }
947 if ((*ctx) && ((*ctx)->state % 2) == 1) {
948 // LCOV_EXCL_START
949 return CeedError((*ctx)->ceed, 1, "Cannot destroy CeedQFunctionContext, the access lock is in use");
950 // LCOV_EXCL_STOP
951 }
952
953 CeedCall(CeedQFunctionContextDestroyData(*ctx));
954 if ((*ctx)->Destroy) CeedCall((*ctx)->Destroy(*ctx));

--- 13 unchanged lines hidden ---
949 if ((*ctx) && ((*ctx)->state % 2) == 1) {
950 // LCOV_EXCL_START
951 return CeedError((*ctx)->ceed, 1, "Cannot destroy CeedQFunctionContext, the access lock is in use");
952 // LCOV_EXCL_STOP
953 }
954
955 CeedCall(CeedQFunctionContextDestroyData(*ctx));
956 if ((*ctx)->Destroy) CeedCall((*ctx)->Destroy(*ctx));

--- 13 unchanged lines hidden ---