test: move container_of() macro into task.h
This commit is contained in:
parent
fbbc085448
commit
1161d31aea
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user