diff options
author | teor <teor@torproject.org> | 2019-11-18 11:21:37 +1000 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-11-18 11:21:37 +1000 |
commit | c34fb3413dee5be00be7299a63c294ddb86b0599 (patch) | |
tree | 61bf8e02a341314267f8820ea7ebcc50259f27a7 /src/lib/container/handles.h | |
parent | 183f89ccacdf7ca140f6d83345a9389e94119f5e (diff) | |
parent | 59ba61a69050edacb560a9fa6ad302346e14095e (diff) | |
download | tor-c34fb3413dee5be00be7299a63c294ddb86b0599.tar.gz tor-c34fb3413dee5be00be7299a63c294ddb86b0599.zip |
Merge remote-tracking branch 'tor-github/pr/1517'
Diffstat (limited to 'src/lib/container/handles.h')
-rw-r--r-- | src/lib/container/handles.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/lib/container/handles.h b/src/lib/container/handles.h index ca7c94559e..798c8a367c 100644 --- a/src/lib/container/handles.h +++ b/src/lib/container/handles.h @@ -16,33 +16,33 @@ * To enable a type to have handles, add a HANDLE_ENTRY() field in its * definition, as in: * - * struct walrus { - * HANDLE_ENTRY(wlr, walrus); + * struct walrus_t { + * HANDLE_ENTRY(wlr, walrus_t); * // ... * }; * - * And invoke HANDLE_DECL(wlr, walrus, [static]) to declare the handle + * And invoke HANDLE_DECL(wlr, walrus_t, [static]) to declare the handle * manipulation functions (typically in a header): * * // opaque handle to walrus. * typedef struct wlr_handle_t wlr_handle_t; * * // make a new handle - * struct wlr_handle_t *wlr_handle_new(struct walrus *); + * struct wlr_handle_t *wlr_handle_new(struct walrus_t *); * * // release a handle * void wlr_handle_free(wlr_handle_t *); * * // return the pointed-to walrus, or NULL. - * struct walrus *wlr_handle_get(wlr_handle_t *). + * struct walrus_t *wlr_handle_get(wlr_handle_t *). * * // call this function when you're about to free the walrus; * // it invalidates all handles. (IF YOU DON'T, YOU WILL HAVE * // DANGLING REFERENCES) - * void wlr_handles_clear(struct walrus *); + * void wlr_handles_clear(struct walrus_t *); * * Finally, use HANDLE_IMPL() to define the above functions in some - * appropriate C file: HANDLE_IMPL(wlr, walrus, [static]) + * appropriate C file: HANDLE_IMPL(wlr, walrus_t, [static]) * **/ @@ -57,12 +57,13 @@ #define HANDLE_ENTRY(name, structname) \ struct name ## _handle_head_t *handle_head -#define HANDLE_DECL(name, structname, linkage) \ +#define HANDLE_DECL(name, structname_t, linkage) \ typedef struct name ## _handle_t name ## _handle_t; \ - linkage name ## _handle_t *name ## _handle_new(struct structname *object); \ + linkage name ## _handle_t *name ## _handle_new( \ + struct structname_t *object); \ linkage void name ## _handle_free_(name ## _handle_t *); \ - linkage struct structname *name ## _handle_get(name ## _handle_t *); \ - linkage void name ## _handles_clear(struct structname *object); + linkage struct structname_t *name ## _handle_get(name ## _handle_t *); \ + linkage void name ## _handles_clear(struct structname_t *object); /* * Implementation notes: there are lots of possible implementations here. We |