diff --git a/deps/ccommon/include/cc_queue.h b/deps/ccommon/include/cc_queue.h index c8f8a5ce2..4349f5107 100644 --- a/deps/ccommon/include/cc_queue.h +++ b/deps/ccommon/include/cc_queue.h @@ -127,6 +127,7 @@ extern "C" { * _INSERT_TAIL - - + + + * _REMOVE_HEAD + - + - - * _REMOVE + + + + + + * _REINIT - - - + - * */ @@ -691,6 +692,23 @@ struct { \ (head2)->tqh_last = &(head2)->tqh_first; \ } while (0) +#define TAILQ_REINIT(head, var, field, offset) do { \ + TAILQ_FIRST((head)) = var; \ + *(head)->tqh_last = NULL; \ + TAILQ_FOREACH(var, head, s_tqe) { \ + if ((TAILQ_NEXT((var), field)) != NULL) { \ + TAILQ_NEXT((var), field) = \ + (void *)((char *)(TAILQ_NEXT((var), field)) + (offset));\ + } \ + if ((var) == TAILQ_FIRST(head)) { \ + (var)->field.tqe_prev = &TAILQ_FIRST(head); \ + } else { \ + (var)->field.tqe_prev = \ + (void *)((char *)((var)->field.tqe_prev) + (offset)); \ + } \ + } \ +} while (0) + /* * Circular queue declarations. */