ceed-qfunction.c (fae3c42f526d51ae8dea7d80776fed001f9a2588) ceed-qfunction.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>

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

1019
1020 @param[in,out] qf CeedQFunction to destroy
1021
1022 @return An error code: 0 - success, otherwise - failure
1023
1024 @ref User
1025**/
1026int CeedQFunctionDestroy(CeedQFunction *qf) {
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>

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

1019
1020 @param[in,out] qf CeedQFunction to destroy
1021
1022 @return An error code: 0 - success, otherwise - failure
1023
1024 @ref User
1025**/
1026int CeedQFunctionDestroy(CeedQFunction *qf) {
1027 if (!*qf || --(*qf)->ref_count > 0) return CEED_ERROR_SUCCESS;
1027 if (!*qf || --(*qf)->ref_count > 0) {
1028 *qf = NULL;
1029 return CEED_ERROR_SUCCESS;
1030 }
1028 // Backend destroy
1029 if ((*qf)->Destroy) {
1030 CeedCall((*qf)->Destroy(*qf));
1031 }
1032 // Free fields
1033 for (CeedInt i = 0; i < (*qf)->num_input_fields; i++) {
1034 CeedCall(CeedFree(&(*(*qf)->input_fields[i]).field_name));
1035 CeedCall(CeedFree(&(*qf)->input_fields[i]));

--- 21 unchanged lines hidden ---
1031 // Backend destroy
1032 if ((*qf)->Destroy) {
1033 CeedCall((*qf)->Destroy(*qf));
1034 }
1035 // Free fields
1036 for (CeedInt i = 0; i < (*qf)->num_input_fields; i++) {
1037 CeedCall(CeedFree(&(*(*qf)->input_fields[i]).field_name));
1038 CeedCall(CeedFree(&(*qf)->input_fields[i]));

--- 21 unchanged lines hidden ---