Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

uv-common.h: mark static functions unused, don't use `inline`

  • Loading branch information
piscisaureus committed May 15, 2012
1 parent 14fd32b commit 28a422b048a9edaff5f71ee0f63435d53c6a96bf
Showing with 21 additions and 28 deletions.
  1. +21 −28 src/uv-common.h
@@ -35,20 +35,13 @@

#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

#ifdef DEBUG
# ifdef _MSC_VER
# define INLINE /* empty */
# else
# define INLINE __attribute__((unused))
# endif
#ifdef _MSC_VER
# define UNUSED /* empty */
#else
# ifdef _MSC_VER
# define INLINE __inline
# else
# define INLINE inline
# endif
# define UNUSED __attribute__((unused))
#endif


#ifndef _WIN32
enum {
UV__ACTIVE = 0x4000,
@@ -108,57 +101,57 @@ int uv__tcp_connect6(uv_connect_t* req,

#ifndef UV_LEAN_AND_MEAN

INLINE static int uv__has_active_handles(const uv_loop_t* loop) {
UNUSED static int uv__has_active_handles(const uv_loop_t* loop) {
return !ngx_queue_empty(&loop->active_handles);
}

INLINE static int uv__has_active_reqs(const uv_loop_t* loop) {
UNUSED static int uv__has_active_reqs(const uv_loop_t* loop) {
return !ngx_queue_empty(&loop->active_reqs);
}

INLINE static void uv__active_handle_add(uv_handle_t* h) {
UNUSED static void uv__active_handle_add(uv_handle_t* h) {
ngx_queue_insert_tail(&h->loop->active_handles, &h->active_queue);
}

INLINE static void uv__active_handle_rm(uv_handle_t* h) {
UNUSED static void uv__active_handle_rm(uv_handle_t* h) {
assert(uv__has_active_handles(h->loop));
ngx_queue_remove(&h->active_queue);
}

INLINE static void uv__req_register(uv_loop_t* loop, uv_req_t* req) {
UNUSED static void uv__req_register(uv_loop_t* loop, uv_req_t* req) {
ngx_queue_insert_tail(&loop->active_reqs, &req->active_queue);
}

INLINE static void uv__req_unregister(uv_loop_t* loop, uv_req_t* req) {
UNUSED static void uv__req_unregister(uv_loop_t* loop, uv_req_t* req) {
assert(uv__has_active_reqs(loop));
ngx_queue_remove(&req->active_queue);
}

#else /* UV_LEAN_AND_MEAN */

INLINE static int uv__has_active_handles(const uv_loop_t* loop) {
UNUSED static int uv__has_active_handles(const uv_loop_t* loop) {
return loop->active_handles > 0;
}

INLINE static int uv__has_active_reqs(const uv_loop_t* loop) {
UNUSED static int uv__has_active_reqs(const uv_loop_t* loop) {
return loop->active_reqs > 0;
}

INLINE static void uv__active_handle_add(uv_handle_t* h) {
UNUSED static void uv__active_handle_add(uv_handle_t* h) {
h->loop->active_handles++;
}

INLINE static void uv__active_handle_rm(uv_handle_t* h) {
UNUSED static void uv__active_handle_rm(uv_handle_t* h) {
assert(h->loop->active_handles > 0);
h->loop->active_handles--;
}

INLINE static void uv__req_register(uv_loop_t* loop, uv_req_t* req) {
UNUSED static void uv__req_register(uv_loop_t* loop, uv_req_t* req) {
loop->active_reqs++;
(void) req;
}

INLINE static void uv__req_unregister(uv_loop_t* loop, uv_req_t* req) {
UNUSED static void uv__req_unregister(uv_loop_t* loop, uv_req_t* req) {
assert(loop->active_reqs > 0);
loop->active_reqs--;
(void) req;
@@ -172,35 +165,35 @@ INLINE static void uv__req_unregister(uv_loop_t* loop, uv_req_t* req) {
#define uv__req_register(loop, req) uv__req_register((loop), (uv_req_t*)(req))
#define uv__req_unregister(loop, req) uv__req_unregister((loop), (uv_req_t*)(req))

INLINE static int uv__is_active(const uv_handle_t* h) {
UNUSED static int uv__is_active(const uv_handle_t* h) {
return !!(h->flags & UV__ACTIVE);
}
#define uv__is_active(h) uv__is_active((const uv_handle_t*)(h))

INLINE static void uv__handle_start(uv_handle_t* h) {
UNUSED static void uv__handle_start(uv_handle_t* h) {
if (h->flags & UV__ACTIVE) return;
if (!(h->flags & UV__REF)) return;
h->flags |= UV__ACTIVE;
uv__active_handle_add(h);
}
#define uv__handle_start(h) uv__handle_start((uv_handle_t*)(h))

INLINE static void uv__handle_stop(uv_handle_t* h) {
UNUSED static void uv__handle_stop(uv_handle_t* h) {
if (!(h->flags & UV__ACTIVE)) return;
if (!(h->flags & UV__REF)) return;
uv__active_handle_rm(h);
h->flags &= ~UV__ACTIVE;
}
#define uv__handle_stop(h) uv__handle_stop((uv_handle_t*)(h))

INLINE static void uv__handle_ref(uv_handle_t* h) {
UNUSED static void uv__handle_ref(uv_handle_t* h) {
if (h->flags & UV__REF) return;
if (h->flags & UV__ACTIVE) uv__active_handle_add(h);
h->flags |= UV__REF;
}
#define uv__handle_ref(h) uv__handle_ref((uv_handle_t*)(h))

INLINE static void uv__handle_unref(uv_handle_t* h) {
UNUSED static void uv__handle_unref(uv_handle_t* h) {
if (!(h->flags & UV__REF)) return;
if (h->flags & UV__ACTIVE) uv__active_handle_rm(h);
h->flags &= ~UV__REF;

0 comments on commit 28a422b

Please sign in to comment.
You can’t perform that action at this time.