Browse Source

Remove some unnecessary handlescopes

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
7c9919f810
  1. 8
      src/node_http_parser.cc

8
src/node_http_parser.cc

@ -68,9 +68,6 @@ static Persistent<String> should_keep_alive_sym;
#define DEFINE_HTTP_CB(name) \ #define DEFINE_HTTP_CB(name) \
static int name(http_parser *p) { \ static int name(http_parser *p) { \
Parser *parser = static_cast<Parser*>(p->data); \ Parser *parser = static_cast<Parser*>(p->data); \
\
HandleScope scope; \
\
Local<Value> cb_value = parser->handle_->Get(name##_sym); \ Local<Value> cb_value = parser->handle_->Get(name##_sym); \
if (!cb_value->IsFunction()) return 0; \ if (!cb_value->IsFunction()) return 0; \
Local<Function> cb = Local<Function>::Cast(cb_value); \ Local<Function> cb = Local<Function>::Cast(cb_value); \
@ -82,7 +79,6 @@ static Persistent<String> should_keep_alive_sym;
#define DEFINE_HTTP_DATA_CB(name) \ #define DEFINE_HTTP_DATA_CB(name) \
static int name(http_parser *p, const char *at, size_t length) { \ static int name(http_parser *p, const char *at, size_t length) { \
Parser *parser = static_cast<Parser*>(p->data); \ Parser *parser = static_cast<Parser*>(p->data); \
HandleScope scope; \
assert(parser->buffer_); \ assert(parser->buffer_); \
Local<Value> cb_value = parser->handle_->Get(name##_sym); \ Local<Value> cb_value = parser->handle_->Get(name##_sym); \
if (!cb_value->IsFunction()) return 0; \ if (!cb_value->IsFunction()) return 0; \
@ -145,8 +141,6 @@ class Parser : public ObjectWrap {
static int on_headers_complete(http_parser *p) { static int on_headers_complete(http_parser *p) {
Parser *parser = static_cast<Parser*>(p->data); Parser *parser = static_cast<Parser*>(p->data);
HandleScope scope;
Local<Value> cb_value = parser->handle_->Get(on_headers_complete_sym); Local<Value> cb_value = parser->handle_->Get(on_headers_complete_sym);
if (!cb_value->IsFunction()) return 0; if (!cb_value->IsFunction()) return 0;
Local<Function> cb = Local<Function>::Cast(cb_value); Local<Function> cb = Local<Function>::Cast(cb_value);
@ -267,9 +261,7 @@ class Parser : public ObjectWrap {
assert(!parser->buffer_); assert(!parser->buffer_);
parser->Ref();
http_parser_execute(&(parser->parser_), NULL, 0); http_parser_execute(&(parser->parser_), NULL, 0);
parser->Unref();
return Undefined(); return Undefined();
} }

Loading…
Cancel
Save