test: move container_of() macro into task.h

This commit is contained in:
Ben Noordhuis 2012-01-18 15:53:38 +01:00
parent fbbc085448
commit 1161d31aea
4 changed files with 5 additions and 14 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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;