diff options
author | 2017-11-06 12:50:14 -0800 | |
---|---|---|
committer | 2017-11-06 12:50:14 -0800 | |
commit | 0be9ad440878b94d9a68f35992c23e7f99375dbc (patch) | |
tree | 9ce37a5e50f1ee47df6d42ef3e44d63160e8d0dc /src/core/lib/iomgr/error.cc | |
parent | c60659ad023d01f8d0f6ad0f87fefbd3740002d0 (diff) | |
parent | e759d2ad7abdb0702970eeccc5f033ff4b2a4c7f (diff) |
Merge github.com:grpc/grpc into lfe3
Diffstat (limited to 'src/core/lib/iomgr/error.cc')
-rw-r--r-- | src/core/lib/iomgr/error.cc | 218 |
1 files changed, 109 insertions, 109 deletions
diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index 2ea6cf1301..123ff72851 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -42,7 +42,7 @@ grpc_tracer_flag grpc_trace_error_refcount = GRPC_TRACER_INITIALIZER(false, "error_refcount"); #endif -static const char *error_int_name(grpc_error_ints key) { +static const char* error_int_name(grpc_error_ints key) { switch (key) { case GRPC_ERROR_INT_ERRNO: return "errno"; @@ -80,7 +80,7 @@ static const char *error_int_name(grpc_error_ints key) { GPR_UNREACHABLE_CODE(return "unknown"); } -static const char *error_str_name(grpc_error_strs key) { +static const char* error_str_name(grpc_error_strs key) { switch (key) { case GRPC_ERROR_STR_KEY: return "key"; @@ -112,7 +112,7 @@ static const char *error_str_name(grpc_error_strs key) { GPR_UNREACHABLE_CODE(return "unknown"); } -static const char *error_time_name(grpc_error_times key) { +static const char* error_time_name(grpc_error_times key) { switch (key) { case GRPC_ERROR_TIME_CREATED: return "created"; @@ -122,13 +122,13 @@ static const char *error_time_name(grpc_error_times key) { GPR_UNREACHABLE_CODE(return "unknown"); } -bool grpc_error_is_special(grpc_error *err) { +bool grpc_error_is_special(grpc_error* err) { return err == GRPC_ERROR_NONE || err == GRPC_ERROR_OOM || err == GRPC_ERROR_CANCELLED; } #ifndef NDEBUG -grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line) { +grpc_error* grpc_error_ref(grpc_error* err, const char* file, int line) { if (grpc_error_is_special(err)) return err; if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err, @@ -139,17 +139,17 @@ grpc_error *grpc_error_ref(grpc_error *err, const char *file, int line) { return err; } #else -grpc_error *grpc_error_ref(grpc_error *err) { +grpc_error* grpc_error_ref(grpc_error* err) { if (grpc_error_is_special(err)) return err; gpr_ref(&err->atomics.refs); return err; } #endif -static void unref_errs(grpc_error *err) { +static void unref_errs(grpc_error* err) { uint8_t slot = err->first_err; while (slot != UINT8_MAX) { - grpc_linked_error *lerr = (grpc_linked_error *)(err->arena + slot); + grpc_linked_error* lerr = (grpc_linked_error*)(err->arena + slot); GRPC_ERROR_UNREF(lerr->err); GPR_ASSERT(err->last_err == slot ? lerr->next == UINT8_MAX : lerr->next != UINT8_MAX); @@ -163,25 +163,25 @@ static void unref_slice(grpc_slice slice) { grpc_exec_ctx_finish(&exec_ctx); } -static void unref_strs(grpc_error *err) { +static void unref_strs(grpc_error* err) { for (size_t which = 0; which < GRPC_ERROR_STR_MAX; ++which) { uint8_t slot = err->strs[which]; if (slot != UINT8_MAX) { - unref_slice(*(grpc_slice *)(err->arena + slot)); + unref_slice(*(grpc_slice*)(err->arena + slot)); } } } -static void error_destroy(grpc_error *err) { +static void error_destroy(grpc_error* err) { GPR_ASSERT(!grpc_error_is_special(err)); unref_errs(err); unref_strs(err); - gpr_free((void *)gpr_atm_acq_load(&err->atomics.error_string)); + gpr_free((void*)gpr_atm_acq_load(&err->atomics.error_string)); gpr_free(err); } #ifndef NDEBUG -void grpc_error_unref(grpc_error *err, const char *file, int line) { +void grpc_error_unref(grpc_error* err, const char* file, int line) { if (grpc_error_is_special(err)) return; if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { gpr_log(GPR_DEBUG, "%p: %" PRIdPTR " -> %" PRIdPTR " [%s:%d]", err, @@ -193,7 +193,7 @@ void grpc_error_unref(grpc_error *err, const char *file, int line) { } } #else -void grpc_error_unref(grpc_error *err) { +void grpc_error_unref(grpc_error* err) { if (grpc_error_is_special(err)) return; if (gpr_unref(&err->atomics.refs)) { error_destroy(err); @@ -201,7 +201,7 @@ void grpc_error_unref(grpc_error *err) { } #endif -static uint8_t get_placement(grpc_error **err, size_t size) { +static uint8_t get_placement(grpc_error** err, size_t size) { GPR_ASSERT(*err); uint8_t slots = (uint8_t)(size / sizeof(intptr_t)); if ((*err)->arena_size + slots > (*err)->arena_capacity) { @@ -211,9 +211,9 @@ static uint8_t get_placement(grpc_error **err, size_t size) { return UINT8_MAX; } #ifndef NDEBUG - grpc_error *orig = *err; + grpc_error* orig = *err; #endif - *err = (grpc_error *)gpr_realloc( + *err = (grpc_error*)gpr_realloc( *err, sizeof(grpc_error) + (*err)->arena_capacity * sizeof(intptr_t)); #ifndef NDEBUG if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { @@ -228,7 +228,7 @@ static uint8_t get_placement(grpc_error **err, size_t size) { return placement; } -static void internal_set_int(grpc_error **err, grpc_error_ints which, +static void internal_set_int(grpc_error** err, grpc_error_ints which, intptr_t value) { uint8_t slot = (*err)->ints[which]; if (slot == UINT8_MAX) { @@ -243,36 +243,36 @@ static void internal_set_int(grpc_error **err, grpc_error_ints which, (*err)->arena[slot] = value; } -static void internal_set_str(grpc_error **err, grpc_error_strs which, +static void internal_set_str(grpc_error** err, grpc_error_strs which, grpc_slice value) { uint8_t slot = (*err)->strs[which]; if (slot == UINT8_MAX) { slot = get_placement(err, sizeof(value)); if (slot == UINT8_MAX) { - const char *str = grpc_slice_to_c_string(value); + const char* str = grpc_slice_to_c_string(value); gpr_log(GPR_ERROR, "Error %p is full, dropping string {\"%s\":\"%s\"}", *err, error_str_name(which), str); - gpr_free((void *)str); + gpr_free((void*)str); return; } } else { - unref_slice(*(grpc_slice *)((*err)->arena + slot)); + unref_slice(*(grpc_slice*)((*err)->arena + slot)); } (*err)->strs[which] = slot; memcpy((*err)->arena + slot, &value, sizeof(value)); } -static char *fmt_time(gpr_timespec tm); -static void internal_set_time(grpc_error **err, grpc_error_times which, +static char* fmt_time(gpr_timespec tm); +static void internal_set_time(grpc_error** err, grpc_error_times which, gpr_timespec value) { uint8_t slot = (*err)->times[which]; if (slot == UINT8_MAX) { slot = get_placement(err, sizeof(value)); if (slot == UINT8_MAX) { - const char *time_str = fmt_time(value); + const char* time_str = fmt_time(value); gpr_log(GPR_ERROR, "Error %p is full, dropping \"%s\":\"%s\"}", *err, error_time_name(which), time_str); - gpr_free((void *)time_str); + gpr_free((void*)time_str); return; } } @@ -280,7 +280,7 @@ static void internal_set_time(grpc_error **err, grpc_error_times which, memcpy((*err)->arena + slot, &value, sizeof(value)); } -static void internal_add_error(grpc_error **err, grpc_error *new_err) { +static void internal_add_error(grpc_error** err, grpc_error* new_err) { grpc_linked_error new_last = {new_err, UINT8_MAX}; uint8_t slot = get_placement(err, sizeof(grpc_linked_error)); if (slot == UINT8_MAX) { @@ -295,8 +295,8 @@ static void internal_add_error(grpc_error **err, grpc_error *new_err) { (*err)->first_err = slot; } else { GPR_ASSERT((*err)->last_err != UINT8_MAX); - grpc_linked_error *old_last = - (grpc_linked_error *)((*err)->arena + (*err)->last_err); + grpc_linked_error* old_last = + (grpc_linked_error*)((*err)->arena + (*err)->last_err); old_last->next = slot; (*err)->last_err = slot; } @@ -316,14 +316,14 @@ static void internal_add_error(grpc_error **err, grpc_error *new_err) { // It is very common to include and extra int and string in an error #define SURPLUS_CAPACITY (2 * SLOTS_PER_INT + SLOTS_PER_TIME) -grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, - grpc_error **referencing, +grpc_error* grpc_error_create(const char* file, int line, grpc_slice desc, + grpc_error** referencing, size_t num_referencing) { GPR_TIMER_BEGIN("grpc_error_create", 0); uint8_t initial_arena_capacity = (uint8_t)( DEFAULT_ERROR_CAPACITY + (uint8_t)(num_referencing * SLOTS_PER_LINKED_ERROR) + SURPLUS_CAPACITY); - grpc_error *err = (grpc_error *)gpr_malloc( + grpc_error* err = (grpc_error*)gpr_malloc( sizeof(*err) + initial_arena_capacity * sizeof(intptr_t)); if (err == NULL) { // TODO(ctiller): make gpr_malloc return NULL return GRPC_ERROR_OOM; @@ -364,27 +364,27 @@ grpc_error *grpc_error_create(const char *file, int line, grpc_slice desc, return err; } -static void ref_strs(grpc_error *err) { +static void ref_strs(grpc_error* err) { for (size_t i = 0; i < GRPC_ERROR_STR_MAX; ++i) { uint8_t slot = err->strs[i]; if (slot != UINT8_MAX) { - grpc_slice_ref_internal(*(grpc_slice *)(err->arena + slot)); + grpc_slice_ref_internal(*(grpc_slice*)(err->arena + slot)); } } } -static void ref_errs(grpc_error *err) { +static void ref_errs(grpc_error* err) { uint8_t slot = err->first_err; while (slot != UINT8_MAX) { - grpc_linked_error *lerr = (grpc_linked_error *)(err->arena + slot); + grpc_linked_error* lerr = (grpc_linked_error*)(err->arena + slot); GRPC_ERROR_REF(lerr->err); slot = lerr->next; } } -static grpc_error *copy_error_and_unref(grpc_error *in) { +static grpc_error* copy_error_and_unref(grpc_error* in) { GPR_TIMER_BEGIN("copy_error_and_unref", 0); - grpc_error *out; + grpc_error* out; if (grpc_error_is_special(in)) { out = GRPC_ERROR_CREATE_FROM_STATIC_STRING("unknown"); if (in == GRPC_ERROR_NONE) { @@ -408,8 +408,8 @@ static grpc_error *copy_error_and_unref(grpc_error *in) { if (in->arena_capacity - in->arena_size < (uint8_t)SLOTS_PER_STR) { new_arena_capacity = (uint8_t)(3 * new_arena_capacity / 2); } - out = (grpc_error *)gpr_malloc(sizeof(*in) + - new_arena_capacity * sizeof(intptr_t)); + out = (grpc_error*)gpr_malloc(sizeof(*in) + + new_arena_capacity * sizeof(intptr_t)); #ifndef NDEBUG if (GRPC_TRACER_ON(grpc_trace_error_refcount)) { gpr_log(GPR_DEBUG, "%p create copying %p", out, in); @@ -417,7 +417,7 @@ static grpc_error *copy_error_and_unref(grpc_error *in) { #endif // bulk memcpy of the rest of the struct. size_t skip = sizeof(&out->atomics); - memcpy((void *)((uintptr_t)out + skip), (void *)((uintptr_t)in + skip), + memcpy((void*)((uintptr_t)out + skip), (void*)((uintptr_t)in + skip), sizeof(*in) + (in->arena_size * sizeof(intptr_t)) - skip); // manually set the atomics and the new capacity gpr_atm_no_barrier_store(&out->atomics.error_string, 0); @@ -431,19 +431,19 @@ static grpc_error *copy_error_and_unref(grpc_error *in) { return out; } -grpc_error *grpc_error_set_int(grpc_error *src, grpc_error_ints which, +grpc_error* grpc_error_set_int(grpc_error* src, grpc_error_ints which, intptr_t value) { GPR_TIMER_BEGIN("grpc_error_set_int", 0); - grpc_error *new_err = copy_error_and_unref(src); + grpc_error* new_err = copy_error_and_unref(src); internal_set_int(&new_err, which, value); GPR_TIMER_END("grpc_error_set_int", 0); return new_err; } typedef struct { - grpc_error *error; + grpc_error* error; grpc_status_code code; - const char *msg; + const char* msg; } special_error_status_map; static special_error_status_map error_status_map[] = { {GRPC_ERROR_NONE, GRPC_STATUS_OK, ""}, @@ -451,7 +451,7 @@ static special_error_status_map error_status_map[] = { {GRPC_ERROR_OOM, GRPC_STATUS_RESOURCE_EXHAUSTED, "Out of memory"}, }; -bool grpc_error_get_int(grpc_error *err, grpc_error_ints which, intptr_t *p) { +bool grpc_error_get_int(grpc_error* err, grpc_error_ints which, intptr_t* p) { GPR_TIMER_BEGIN("grpc_error_get_int", 0); if (grpc_error_is_special(err)) { if (which == GRPC_ERROR_INT_GRPC_STATUS) { @@ -476,17 +476,17 @@ bool grpc_error_get_int(grpc_error *err, grpc_error_ints which, intptr_t *p) { return false; } -grpc_error *grpc_error_set_str(grpc_error *src, grpc_error_strs which, +grpc_error* grpc_error_set_str(grpc_error* src, grpc_error_strs which, grpc_slice str) { GPR_TIMER_BEGIN("grpc_error_set_str", 0); - grpc_error *new_err = copy_error_and_unref(src); + grpc_error* new_err = copy_error_and_unref(src); internal_set_str(&new_err, which, str); GPR_TIMER_END("grpc_error_set_str", 0); return new_err; } -bool grpc_error_get_str(grpc_error *err, grpc_error_strs which, - grpc_slice *str) { +bool grpc_error_get_str(grpc_error* err, grpc_error_strs which, + grpc_slice* str) { if (grpc_error_is_special(err)) { if (which == GRPC_ERROR_STR_GRPC_MESSAGE) { for (size_t i = 0; i < GPR_ARRAY_SIZE(error_status_map); i++) { @@ -500,53 +500,53 @@ bool grpc_error_get_str(grpc_error *err, grpc_error_strs which, } uint8_t slot = err->strs[which]; if (slot != UINT8_MAX) { - *str = *(grpc_slice *)(err->arena + slot); + *str = *(grpc_slice*)(err->arena + slot); return true; } else { return false; } } -grpc_error *grpc_error_add_child(grpc_error *src, grpc_error *child) { +grpc_error* grpc_error_add_child(grpc_error* src, grpc_error* child) { GPR_TIMER_BEGIN("grpc_error_add_child", 0); - grpc_error *new_err = copy_error_and_unref(src); + grpc_error* new_err = copy_error_and_unref(src); internal_add_error(&new_err, child); GPR_TIMER_END("grpc_error_add_child", 0); return new_err; } -static const char *no_error_string = "\"No Error\""; -static const char *oom_error_string = "\"Out of memory\""; -static const char *cancelled_error_string = "\"Cancelled\""; +static const char* no_error_string = "\"No Error\""; +static const char* oom_error_string = "\"Out of memory\""; +static const char* cancelled_error_string = "\"Cancelled\""; typedef struct { - char *key; - char *value; + char* key; + char* value; } kv_pair; typedef struct { - kv_pair *kvs; + kv_pair* kvs; size_t num_kvs; size_t cap_kvs; } kv_pairs; -static void append_chr(char c, char **s, size_t *sz, size_t *cap) { +static void append_chr(char c, char** s, size_t* sz, size_t* cap) { if (*sz == *cap) { *cap = GPR_MAX(8, 3 * *cap / 2); - *s = (char *)gpr_realloc(*s, *cap); + *s = (char*)gpr_realloc(*s, *cap); } (*s)[(*sz)++] = c; } -static void append_str(const char *str, char **s, size_t *sz, size_t *cap) { - for (const char *c = str; *c; c++) { +static void append_str(const char* str, char** s, size_t* sz, size_t* cap) { + for (const char* c = str; *c; c++) { append_chr(*c, s, sz, cap); } } -static void append_esc_str(const uint8_t *str, size_t len, char **s, size_t *sz, - size_t *cap) { - static const char *hex = "0123456789abcdef"; +static void append_esc_str(const uint8_t* str, size_t len, char** s, size_t* sz, + size_t* cap) { + static const char* hex = "0123456789abcdef"; append_chr('"', s, sz, cap); for (size_t i = 0; i < len; i++, str++) { if (*str < 32 || *str >= 127) { @@ -582,28 +582,28 @@ static void append_esc_str(const uint8_t *str, size_t len, char **s, size_t *sz, append_chr('"', s, sz, cap); } -static void append_kv(kv_pairs *kvs, char *key, char *value) { +static void append_kv(kv_pairs* kvs, char* key, char* value) { if (kvs->num_kvs == kvs->cap_kvs) { kvs->cap_kvs = GPR_MAX(3 * kvs->cap_kvs / 2, 4); kvs->kvs = - (kv_pair *)gpr_realloc(kvs->kvs, sizeof(*kvs->kvs) * kvs->cap_kvs); + (kv_pair*)gpr_realloc(kvs->kvs, sizeof(*kvs->kvs) * kvs->cap_kvs); } kvs->kvs[kvs->num_kvs].key = key; kvs->kvs[kvs->num_kvs].value = value; kvs->num_kvs++; } -static char *key_int(grpc_error_ints which) { +static char* key_int(grpc_error_ints which) { return gpr_strdup(error_int_name(which)); } -static char *fmt_int(intptr_t p) { - char *s; +static char* fmt_int(intptr_t p) { + char* s; gpr_asprintf(&s, "%" PRIdPTR, p); return s; } -static void collect_ints_kvs(grpc_error *err, kv_pairs *kvs) { +static void collect_ints_kvs(grpc_error* err, kv_pairs* kvs) { for (size_t which = 0; which < GRPC_ERROR_INT_MAX; ++which) { uint8_t slot = err->ints[which]; if (slot != UINT8_MAX) { @@ -613,37 +613,37 @@ static void collect_ints_kvs(grpc_error *err, kv_pairs *kvs) { } } -static char *key_str(grpc_error_strs which) { +static char* key_str(grpc_error_strs which) { return gpr_strdup(error_str_name(which)); } -static char *fmt_str(grpc_slice slice) { - char *s = NULL; +static char* fmt_str(grpc_slice slice) { + char* s = NULL; size_t sz = 0; size_t cap = 0; - append_esc_str((const uint8_t *)GRPC_SLICE_START_PTR(slice), + append_esc_str((const uint8_t*)GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice), &s, &sz, &cap); append_chr(0, &s, &sz, &cap); return s; } -static void collect_strs_kvs(grpc_error *err, kv_pairs *kvs) { +static void collect_strs_kvs(grpc_error* err, kv_pairs* kvs) { for (size_t which = 0; which < GRPC_ERROR_STR_MAX; ++which) { uint8_t slot = err->strs[which]; if (slot != UINT8_MAX) { append_kv(kvs, key_str((grpc_error_strs)which), - fmt_str(*(grpc_slice *)(err->arena + slot))); + fmt_str(*(grpc_slice*)(err->arena + slot))); } } } -static char *key_time(grpc_error_times which) { +static char* key_time(grpc_error_times which) { return gpr_strdup(error_time_name(which)); } -static char *fmt_time(gpr_timespec tm) { - char *out; - const char *pfx = "!!"; +static char* fmt_time(gpr_timespec tm) { + char* out; + const char* pfx = "!!"; switch (tm.clock_type) { case GPR_CLOCK_MONOTONIC: pfx = "@monotonic:"; @@ -662,24 +662,24 @@ static char *fmt_time(gpr_timespec tm) { return out; } -static void collect_times_kvs(grpc_error *err, kv_pairs *kvs) { +static void collect_times_kvs(grpc_error* err, kv_pairs* kvs) { for (size_t which = 0; which < GRPC_ERROR_TIME_MAX; ++which) { uint8_t slot = err->times[which]; if (slot != UINT8_MAX) { append_kv(kvs, key_time((grpc_error_times)which), - fmt_time(*(gpr_timespec *)(err->arena + slot))); + fmt_time(*(gpr_timespec*)(err->arena + slot))); } } } -static void add_errs(grpc_error *err, char **s, size_t *sz, size_t *cap) { +static void add_errs(grpc_error* err, char** s, size_t* sz, size_t* cap) { uint8_t slot = err->first_err; bool first = true; while (slot != UINT8_MAX) { - grpc_linked_error *lerr = (grpc_linked_error *)(err->arena + slot); + grpc_linked_error* lerr = (grpc_linked_error*)(err->arena + slot); if (!first) append_chr(',', s, sz, cap); first = false; - const char *e = grpc_error_string(lerr->err); + const char* e = grpc_error_string(lerr->err); append_str(e, s, sz, cap); GPR_ASSERT(err->last_err == slot ? lerr->next == UINT8_MAX : lerr->next != UINT8_MAX); @@ -687,8 +687,8 @@ static void add_errs(grpc_error *err, char **s, size_t *sz, size_t *cap) { } } -static char *errs_string(grpc_error *err) { - char *s = NULL; +static char* errs_string(grpc_error* err) { + char* s = NULL; size_t sz = 0; size_t cap = 0; append_chr('[', &s, &sz, &cap); @@ -698,22 +698,22 @@ static char *errs_string(grpc_error *err) { return s; } -static int cmp_kvs(const void *a, const void *b) { - const kv_pair *ka = (const kv_pair *)a; - const kv_pair *kb = (const kv_pair *)b; +static int cmp_kvs(const void* a, const void* b) { + const kv_pair* ka = (const kv_pair*)a; + const kv_pair* kb = (const kv_pair*)b; return strcmp(ka->key, kb->key); } -static char *finish_kvs(kv_pairs *kvs) { - char *s = NULL; +static char* finish_kvs(kv_pairs* kvs) { + char* s = NULL; size_t sz = 0; size_t cap = 0; append_chr('{', &s, &sz, &cap); for (size_t i = 0; i < kvs->num_kvs; i++) { if (i != 0) append_chr(',', &s, &sz, &cap); - append_esc_str((const uint8_t *)kvs->kvs[i].key, strlen(kvs->kvs[i].key), - &s, &sz, &cap); + append_esc_str((const uint8_t*)kvs->kvs[i].key, strlen(kvs->kvs[i].key), &s, + &sz, &cap); gpr_free(kvs->kvs[i].key); append_chr(':', &s, &sz, &cap); append_str(kvs->kvs[i].value, &s, &sz, &cap); @@ -726,16 +726,16 @@ static char *finish_kvs(kv_pairs *kvs) { return s; } -const char *grpc_error_string(grpc_error *err) { +const char* grpc_error_string(grpc_error* err) { GPR_TIMER_BEGIN("grpc_error_string", 0); if (err == GRPC_ERROR_NONE) return no_error_string; if (err == GRPC_ERROR_OOM) return oom_error_string; if (err == GRPC_ERROR_CANCELLED) return cancelled_error_string; - void *p = (void *)gpr_atm_acq_load(&err->atomics.error_string); + void* p = (void*)gpr_atm_acq_load(&err->atomics.error_string); if (p != NULL) { GPR_TIMER_END("grpc_error_string", 0); - return (const char *)p; + return (const char*)p; } kv_pairs kvs; @@ -750,19 +750,19 @@ const char *grpc_error_string(grpc_error *err) { qsort(kvs.kvs, kvs.num_kvs, sizeof(kv_pair), cmp_kvs); - char *out = finish_kvs(&kvs); + char* out = finish_kvs(&kvs); if (!gpr_atm_rel_cas(&err->atomics.error_string, 0, (gpr_atm)out)) { gpr_free(out); - out = (char *)gpr_atm_no_barrier_load(&err->atomics.error_string); + out = (char*)gpr_atm_no_barrier_load(&err->atomics.error_string); } GPR_TIMER_END("grpc_error_string", 0); return out; } -grpc_error *grpc_os_error(const char *file, int line, int err, - const char *call_name) { +grpc_error* grpc_os_error(const char* file, int line, int err, + const char* call_name) { return grpc_error_set_str( grpc_error_set_str( grpc_error_set_int( @@ -776,10 +776,10 @@ grpc_error *grpc_os_error(const char *file, int line, int err, } #ifdef GPR_WINDOWS -grpc_error *grpc_wsa_error(const char *file, int line, int err, - const char *call_name) { - char *utf8_message = gpr_format_message(err); - grpc_error *error = grpc_error_set_str( +grpc_error* grpc_wsa_error(const char* file, int line, int err, + const char* call_name) { + char* utf8_message = gpr_format_message(err); + grpc_error* error = grpc_error_set_str( grpc_error_set_str( grpc_error_set_int( grpc_error_create(file, line, @@ -793,10 +793,10 @@ grpc_error *grpc_wsa_error(const char *file, int line, int err, } #endif -bool grpc_log_if_error(const char *what, grpc_error *error, const char *file, +bool grpc_log_if_error(const char* what, grpc_error* error, const char* file, int line) { if (error == GRPC_ERROR_NONE) return true; - const char *msg = grpc_error_string(error); + const char* msg = grpc_error_string(error); gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, "%s: %s", what, msg); GRPC_ERROR_UNREF(error); return false; |