aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/iomgr
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2016-09-09 08:44:30 -0700
committerGravatar Mark D. Roth <roth@google.com>2016-09-09 08:44:30 -0700
commit932b10c75bb4674650a6862d2f155f3548ebfede (patch)
tree733d2733581afceb1d522362ad542eef90c78ca2 /src/core/lib/iomgr
parent6ad991783f35bf24b1f31a6aa302774206666d78 (diff)
clang-format
Diffstat (limited to 'src/core/lib/iomgr')
-rw-r--r--src/core/lib/iomgr/error.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/core/lib/iomgr/error.c b/src/core/lib/iomgr/error.c
index 17f19423a3..e13f37f8ed 100644
--- a/src/core/lib/iomgr/error.c
+++ b/src/core/lib/iomgr/error.c
@@ -330,13 +330,13 @@ typedef struct {
const char *msg;
} special_error_status_map;
static special_error_status_map error_status_map[] = {
- { GRPC_ERROR_NONE, GRPC_STATUS_OK, "" },
- { GRPC_ERROR_CANCELLED, GRPC_STATUS_CANCELLED, "RPC cancelled" },
- { GRPC_ERROR_OOM, GRPC_STATUS_RESOURCE_EXHAUSTED, "Out of memory" },
+ {GRPC_ERROR_NONE, GRPC_STATUS_OK, ""},
+ {GRPC_ERROR_CANCELLED, GRPC_STATUS_CANCELLED, "RPC cancelled"},
+ {GRPC_ERROR_OOM, GRPC_STATUS_RESOURCE_EXHAUSTED, "Out of memory"},
};
-static grpc_error *recursively_find_error_with_status(grpc_error* error,
- intptr_t* status) {
+static grpc_error *recursively_find_error_with_status(grpc_error *error,
+ intptr_t *status) {
// If the error itself has a status code, return it.
if (grpc_error_get_int(error, GRPC_ERROR_INT_GRPC_STATUS, status)) {
return error;
@@ -345,12 +345,10 @@ static grpc_error *recursively_find_error_with_status(grpc_error* error,
intptr_t key = 0;
while (true) {
grpc_error *child_error = gpr_avl_get(error->errs, (void *)key++);
- if (child_error == NULL)
- break;
+ if (child_error == NULL) break;
grpc_error *result =
recursively_find_error_with_status(child_error, status);
- if (result != NULL)
- return result;
+ if (result != NULL) return result;
}
return NULL;
}
@@ -359,8 +357,7 @@ void grpc_error_get_status(grpc_error *error, grpc_status_code *code,
const char **msg) {
// Handle special errors via the static map.
for (size_t i = 0;
- i < sizeof(error_status_map) / sizeof(special_error_status_map);
- ++i) {
+ i < sizeof(error_status_map) / sizeof(special_error_status_map); ++i) {
if (error == error_status_map[i].error) {
*code = error_status_map[i].code;
*msg = error_status_map[i].msg;
@@ -371,7 +368,7 @@ void grpc_error_get_status(grpc_error *error, grpc_status_code *code,
// Start with the parent error and recurse through the tree of children
// until we find the first one that has a status code.
intptr_t status = GRPC_STATUS_UNKNOWN; // Default in case we don't find one.
- grpc_error* found_error = recursively_find_error_with_status(error, &status);
+ grpc_error *found_error = recursively_find_error_with_status(error, &status);
*code = (grpc_status_code)status;
// Now populate msg.
// If we found an error with a status code above, use that; otherwise,