diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2014-05-27 23:31:31 +0200 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-05-30 11:45:37 +0100 |
commit | 820aaf5b3d2728d900ba0ff8903d343840766912 (patch) | |
tree | 7d92e15e13be35090b64746efe5e05fc9e3aa735 /src/node_http_parser.cc | |
parent | c7b02034ef80313564c50c59c63a5b640c24e234 (diff) | |
download | node-new-820aaf5b3d2728d900ba0ff8903d343840766912.tar.gz |
src: replace CONTAINER_OF with type-safe function
Replace the CONTAINER_OF macro with a template function that is as
type-safe as a reinterpret_cast<> of an arbitrary pointer can be made.
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'src/node_http_parser.cc')
-rw-r--r-- | src/node_http_parser.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 3739437a0d..911fec398d 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -77,7 +77,7 @@ const uint32_t kOnMessageComplete = 3; #define HTTP_CB(name) \ static int name(http_parser* p_) { \ - Parser* self = CONTAINER_OF(p_, Parser, parser_); \ + Parser* self = ContainerOf(&Parser::parser_, p_); \ return self->name##_(); \ } \ int name##_() @@ -85,7 +85,7 @@ const uint32_t kOnMessageComplete = 3; #define HTTP_DATA_CB(name) \ static int name(http_parser* p_, const char* at, size_t length) { \ - Parser* self = CONTAINER_OF(p_, Parser, parser_); \ + Parser* self = ContainerOf(&Parser::parser_, p_); \ return self->name##_(at, length); \ } \ int name##_(const char* at, size_t length) |