Skip to content

Commit 73b5a3b

Browse files
committed
ceed - replace usage of ceed->op_fallback_parent with ceed->parent
1 parent 07d8a9f commit 73b5a3b

File tree

2 files changed

+4
-28
lines changed

2 files changed

+4
-28
lines changed

include/ceed-impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct Ceed_private {
9696
Ceed parent;
9797
ObjDelegate *obj_delegates;
9898
int obj_delegate_count;
99-
Ceed op_fallback_ceed, op_fallback_parent;
99+
Ceed op_fallback_ceed;
100100
const char *op_fallback_resource;
101101
char **jit_source_roots;
102102
CeedInt num_jit_source_roots, max_jit_source_roots, num_jit_source_roots_readers;

interface/ceed.c

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -663,29 +663,9 @@ int CeedGetOperatorFallbackCeed(Ceed ceed, Ceed *fallback_ceed) {
663663

664664
CeedCall(CeedGetOperatorFallbackResource(ceed, &fallback_resource));
665665
CeedCall(CeedInit(fallback_resource, &fallback_ceed));
666-
fallback_ceed->op_fallback_parent = ceed;
667-
fallback_ceed->Error = ceed->Error;
668-
ceed->op_fallback_ceed = fallback_ceed;
669-
{
670-
const char **jit_source_roots;
671-
CeedInt num_jit_source_roots = 0;
672-
673-
CeedCall(CeedGetJitSourceRoots(ceed, &num_jit_source_roots, &jit_source_roots));
674-
for (CeedInt i = 0; i < num_jit_source_roots; i++) {
675-
CeedCall(CeedAddJitSourceRoot(fallback_ceed, jit_source_roots[i]));
676-
}
677-
CeedCall(CeedRestoreJitSourceRoots(ceed, &jit_source_roots));
678-
}
679-
{
680-
const char **jit_defines;
681-
CeedInt num_jit_defines = 0;
682-
683-
CeedCall(CeedGetJitDefines(ceed, &num_jit_defines, &jit_defines));
684-
for (CeedInt i = 0; i < num_jit_defines; i++) {
685-
CeedCall(CeedAddJitSourceRoot(fallback_ceed, jit_defines[i]));
686-
}
687-
CeedCall(CeedRestoreJitDefines(ceed, &jit_defines));
688-
}
666+
fallback_ceed->parent = ceed;
667+
fallback_ceed->Error = ceed->Error;
668+
ceed->op_fallback_ceed = fallback_ceed;
689669
}
690670
*fallback_ceed = NULL;
691671
CeedDebug(ceed, "Fallback Ceed with backend %s at address %p\n", ceed->op_fallback_resource, ceed->op_fallback_ceed);
@@ -1584,7 +1564,6 @@ int CeedDestroy(Ceed *ceed) {
15841564
// LCOV_EXCL_START
15851565
const char *CeedErrorFormat(Ceed ceed, const char *format, va_list *args) {
15861566
if (ceed->parent) return CeedErrorFormat(ceed->parent, format, args);
1587-
if (ceed->op_fallback_parent) return CeedErrorFormat(ceed->op_fallback_parent, format, args);
15881567
// Using pointer to va_list for better FFI, but clang-tidy can't verify va_list is initalized
15891568
vsnprintf(ceed->err_msg, CEED_MAX_RESOURCE_LEN, format, *args); // NOLINT
15901569
return ceed->err_msg;
@@ -1648,7 +1627,6 @@ int CeedErrorReturn(Ceed ceed, const char *filename, int line_no, const char *fu
16481627
// LCOV_EXCL_START
16491628
int CeedErrorStore(Ceed ceed, const char *filename, int line_no, const char *func, int err_code, const char *format, va_list *args) {
16501629
if (ceed->parent) return CeedErrorStore(ceed->parent, filename, line_no, func, err_code, format, args);
1651-
if (ceed->op_fallback_parent) return CeedErrorStore(ceed->op_fallback_parent, filename, line_no, func, err_code, format, args);
16521630

16531631
// Build message
16541632
int len = snprintf(ceed->err_msg, CEED_MAX_RESOURCE_LEN, "%s:%d in %s(): ", filename, line_no, func);
@@ -1728,7 +1706,6 @@ int CeedSetErrorHandler(Ceed ceed, CeedErrorHandler handler) {
17281706
**/
17291707
int CeedGetErrorMessage(Ceed ceed, const char **err_msg) {
17301708
if (ceed->parent) return CeedGetErrorMessage(ceed->parent, err_msg);
1731-
if (ceed->op_fallback_parent) return CeedGetErrorMessage(ceed->op_fallback_parent, err_msg);
17321709
*err_msg = ceed->err_msg;
17331710
return CEED_ERROR_SUCCESS;
17341711
}
@@ -1747,7 +1724,6 @@ int CeedGetErrorMessage(Ceed ceed, const char **err_msg) {
17471724
**/
17481725
int CeedResetErrorMessage(Ceed ceed, const char **err_msg) {
17491726
if (ceed->parent) return CeedResetErrorMessage(ceed->parent, err_msg);
1750-
if (ceed->op_fallback_parent) return CeedResetErrorMessage(ceed->op_fallback_parent, err_msg);
17511727
*err_msg = NULL;
17521728
memcpy(ceed->err_msg, "No error message stored", 24);
17531729
return CEED_ERROR_SUCCESS;

0 commit comments

Comments
 (0)