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

test: move container_of() macro into task.h

  • Loading branch information...
bnoordhuis committed Jan 18, 2012
1 parent fbbc085 commit 1161d31aea76e6de2f8dac3021fb355d92944920
Showing with 5 additions and 14 deletions.
  1. +0 −4 test/benchmark-tcp-write-batch.c
  2. +0 −4 test/blackhole-server.c
  3. +5 −2 test/task.h
  4. +0 −4 test/test-thread.c
@@ -23,15 +23,11 @@
#include "task.h"

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>

#define WRITE_REQ_DATA "Hello, world."
#define NUM_WRITE_REQS (1000 * 1000)

#define container_of(ptr, type, member) \
((type *) ((char *) (ptr) - offsetof(type, member)))

typedef struct {
uv_write_t req;
uv_buf_t buf;
@@ -23,12 +23,8 @@
#include "task.h"

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>

#define container_of(ptr, type, member) \
((type *) ((char *) (ptr) - offsetof(type, member)))

typedef struct {
uv_tcp_t handle;
uv_shutdown_t shutdown_req;
@@ -22,9 +22,9 @@
#ifndef TASK_H_
#define TASK_H_


#include <stdint.h>
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>

#define TEST_PORT 9123
@@ -40,6 +40,9 @@

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

#define container_of(ptr, type, member) \
((type *) ((char *) (ptr) - offsetof(type, member)))

typedef enum {
TCP = 0,
UDP,
@@ -23,12 +23,8 @@
#include "task.h"

#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>

#define container_of(ptr, type, member) \
((type *) ((char *) (ptr) - offsetof(type, member)))

struct getaddrinfo_req {
uv_thread_t thread_id;
unsigned int counter;

0 comments on commit 1161d31

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