Browse Source

Use cork_container_of instead

pull/988/head
Max Lv 8 years ago
parent
commit
25cc062e5d
6 changed files with 6 additions and 10 deletions
  1. 3
      src/local.c
  2. 2
      src/redir.c
  3. 2
      src/server.c
  4. 2
      src/tunnel.c
  5. 2
      src/udprelay.c
  6. 5
      src/utils.h

3
src/local.c

@ -745,7 +745,8 @@ static void
remote_timeout_cb(EV_P_ ev_timer *watcher, int revents)
{
remote_ctx_t *remote_ctx
= (remote_ctx_t *)container_of(watcher, remote_ctx_t, watcher);
= cork_container_of(watcher, remote_ctx_t, watcher);
remote_t *remote = remote_ctx->remote;
server_t *server = remote->server;

2
src/redir.c

@ -329,7 +329,7 @@ static void
remote_timeout_cb(EV_P_ ev_timer *watcher, int revents)
{
remote_ctx_t *remote_ctx
= (remote_ctx_t *)container_of(watcher, remote_ctx_t, watcher);
= cork_container_of(watcher, remote_ctx_t, watcher);
remote_t *remote = remote_ctx->remote;
server_t *server = remote->server;

2
src/server.c

@ -1050,7 +1050,7 @@ static void
server_timeout_cb(EV_P_ ev_timer *watcher, int revents)
{
server_ctx_t *server_ctx
= (server_ctx_t *)container_of(watcher, server_ctx_t, watcher);
= cork_container_of(watcher, server_ctx_t, watcher);
server_t *server = server_ctx->server;
remote_t *remote = server->remote;

2
src/tunnel.c

@ -285,7 +285,7 @@ static void
remote_timeout_cb(EV_P_ ev_timer *watcher, int revents)
{
remote_ctx_t *remote_ctx
= (remote_ctx_t *)container_of(watcher, remote_ctx_t, watcher);
= cork_container_of(watcher, remote_ctx_t, watcher);
remote_t *remote = remote_ctx->remote;
server_t *server = remote->server;

2
src/udprelay.c

@ -550,7 +550,7 @@ static void
remote_timeout_cb(EV_P_ ev_timer *watcher, int revents)
{
remote_ctx_t *remote_ctx
= (remote_ctx_t *)container_of(watcher, remote_ctx_t, watcher);
= cork_container_of(watcher, remote_ctx_t, watcher);
if (verbose) {
LOGI("[udp] connection timeout");

5
src/utils.h

@ -229,9 +229,4 @@ void *ss_realloc(void *ptr, size_t new_size);
ptr = NULL; \
} while (0)
#ifndef container_of
#define container_of(ptr, type, member) \
((type *) ((char *)(ptr) - offsetof(type, member)))
#endif
#endif // _UTILS_H
Loading…
Cancel
Save