From afc93d1ed607822f7ae77386f48d7226286d62c0 Mon Sep 17 00:00:00 2001 From: John Barboza Date: Mon, 18 Jul 2016 15:46:55 -0400 Subject: [PATCH] unix: unneccessary use const qualifier in container_of MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The type parameter in the "container_of(ptr, type, member)" macro which uses builtin "offsetof(type, member)" should not require cv qualifier. Also note that for some platforms, the "offsetof" builtin does not recognize the cv qualifier in the type. PR-URL: https://github.com/libuv/libuv/pull/948 Reviewed-By: Ben Noordhuis Reviewed-By: Saúl Ibarra Corretgé --- src/unix/timer.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/unix/timer.c b/src/unix/timer.c index ca3ec3db..f46bdf4b 100644 --- a/src/unix/timer.c +++ b/src/unix/timer.c @@ -31,8 +31,8 @@ static int timer_less_than(const struct heap_node* ha, const uv_timer_t* a; const uv_timer_t* b; - a = container_of(ha, const uv_timer_t, heap_node); - b = container_of(hb, const uv_timer_t, heap_node); + a = container_of(ha, uv_timer_t, heap_node); + b = container_of(hb, uv_timer_t, heap_node); if (a->timeout < b->timeout) return 1; @@ -135,7 +135,7 @@ int uv__next_timeout(const uv_loop_t* loop) { if (heap_node == NULL) return -1; /* block indefinitely */ - handle = container_of(heap_node, const uv_timer_t, heap_node); + handle = container_of(heap_node, uv_timer_t, heap_node); if (handle->timeout <= loop->time) return 0;