pull/13335/head
Noah Eisen 7 years ago
parent 9268703dc9
commit 4023fb9357
  1. 32
      src/core/lib/iomgr/closure.h

@ -89,7 +89,7 @@ struct grpc_closure {
/** Arguments to be passed to "cb". */
void* cb_arg;
/** Scheduler to schedule against: NULL to schedule against current execution
/** Scheduler to schedule against: nullptr to schedule against current execution
context */
grpc_closure_scheduler* scheduler;
@ -126,7 +126,7 @@ inline grpc_closure* grpc_closure_init(grpc_closure* closure,
closure->scheduler = scheduler;
#ifndef NDEBUG
closure->scheduled = false;
closure->file_initiated = NULL;
closure->file_initiated = nullptr;
closure->line_initiated = 0;
closure->run = false;
closure->file_created = file;
@ -192,10 +192,10 @@ inline grpc_closure* grpc_closure_create(grpc_iomgr_cb_func cb, void* cb_arg,
#endif
#define GRPC_CLOSURE_LIST_INIT \
{ NULL, NULL }
{ nullptr, nullptr }
inline void grpc_closure_list_init(grpc_closure_list* closure_list) {
closure_list->head = closure_list->tail = NULL;
closure_list->head = closure_list->tail = nullptr;
}
/** add \a closure to the end of \a list
@ -203,13 +203,13 @@ inline void grpc_closure_list_init(grpc_closure_list* closure_list) {
Returns true if \a list becomes non-empty */
inline bool grpc_closure_list_append(grpc_closure_list* closure_list,
grpc_closure* closure, grpc_error* error) {
if (closure == NULL) {
if (closure == nullptr) {
GRPC_ERROR_UNREF(error);
return false;
}
closure->error_data.error = error;
closure->next_data.next = NULL;
bool was_empty = (closure_list->head == NULL);
closure->next_data.next = nullptr;
bool was_empty = (closure_list->head == nullptr);
if (was_empty) {
closure_list->head = closure;
} else {
@ -222,7 +222,7 @@ inline bool grpc_closure_list_append(grpc_closure_list* closure_list,
/** force all success bits in \a list to false */
inline void grpc_closure_list_fail_all(grpc_closure_list* list,
grpc_error* forced_failure) {
for (grpc_closure* c = list->head; c != NULL; c = c->next_data.next) {
for (grpc_closure* c = list->head; c != nullptr; c = c->next_data.next) {
if (c->error_data.error == GRPC_ERROR_NONE) {
c->error_data.error = GRPC_ERROR_REF(forced_failure);
}
@ -233,21 +233,21 @@ inline void grpc_closure_list_fail_all(grpc_closure_list* list,
/** append all closures from \a src to \a dst and empty \a src. */
inline void grpc_closure_list_move(grpc_closure_list* src,
grpc_closure_list* dst) {
if (src->head == NULL) {
if (src->head == nullptr) {
return;
}
if (dst->head == NULL) {
if (dst->head == nullptr) {
*dst = *src;
} else {
dst->tail->next_data.next = src->head;
dst->tail = src->tail;
}
src->head = src->tail = NULL;
src->head = src->tail = nullptr;
}
/** return whether \a list is empty. */
inline bool grpc_closure_list_empty(grpc_closure_list closure_list) {
return closure_list.head == NULL;
return closure_list.head == nullptr;
}
#ifndef NDEBUG
@ -259,7 +259,7 @@ inline void grpc_closure_run(grpc_exec_ctx* exec_ctx, grpc_closure* c,
grpc_error* error) {
#endif
GPR_TIMER_BEGIN("grpc_closure_run", 0);
if (c != NULL) {
if (c != nullptr) {
#ifndef NDEBUG
c->file_initiated = file;
c->line_initiated = line;
@ -293,7 +293,7 @@ inline void grpc_closure_sched(grpc_exec_ctx* exec_ctx, grpc_closure* c,
grpc_error* error) {
#endif
GPR_TIMER_BEGIN("grpc_closure_sched", 0);
if (c != NULL) {
if (c != nullptr) {
#ifndef NDEBUG
if (c->scheduled) {
gpr_log(GPR_ERROR,
@ -334,7 +334,7 @@ inline void grpc_closure_list_sched(grpc_exec_ctx* exec_ctx,
grpc_closure_list* list) {
#endif
grpc_closure* c = list->head;
while (c != NULL) {
while (c != nullptr) {
grpc_closure* next = c->next_data.next;
#ifndef NDEBUG
if (c->scheduled) {
@ -354,7 +354,7 @@ inline void grpc_closure_list_sched(grpc_exec_ctx* exec_ctx,
c->scheduler->vtable->sched(exec_ctx, c, c->error_data.error);
c = next;
}
list->head = list->tail = NULL;
list->head = list->tail = nullptr;
}
/** Schedule all closures in a list to be run. Does not need to be run from a

Loading…
Cancel
Save