diff options
author | 2018-08-21 16:25:40 -0700 | |
---|---|---|
committer | 2018-08-21 16:25:40 -0700 | |
commit | 1cfd81a604699d6ab8095c90e7da5fc588bb3048 (patch) | |
tree | 7d9899debc22889ac45d6a43531fe38224cf512a /src/core/lib/iomgr/error.cc | |
parent | 97ceb5962cc5317b262aa60b8863c7df7799f640 (diff) |
Explain the newer semantics of grpc_error_add_child
Diffstat (limited to 'src/core/lib/iomgr/error.cc')
-rw-r--r-- | src/core/lib/iomgr/error.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index dfd063a695..13bc69ffb6 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -515,15 +515,20 @@ grpc_error* grpc_error_add_child(grpc_error* src, grpc_error* child) { GPR_TIMER_SCOPE("grpc_error_add_child", 0); if (src != GRPC_ERROR_NONE) { if (child == GRPC_ERROR_NONE) { + /* \a child is empty. Simply return the ref to \a src */ return src; } else if (child != src) { grpc_error* new_err = copy_error_and_unref(src); internal_add_error(&new_err, child); return new_err; } else { + /* \a src and \a child are the same. Drop one of the references and return + * the other */ + GRPC_ERROR_UNREF(child); return src; } } else { + /* \a src is empty. Simply return the ref to \a child */ return child; } } |