Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (17 sloc) 0.919 kb
#ifndef UTILS_H
#define UTILS_H
// Credit: @samcday
// http://sambro.is-super-awesome.com/2011/03/03/creating-a-proper-buffer-in-a-node-c-addon/
#define MAKE_FAST_BUFFER(NG_SLOW_BUFFER, NG_FAST_BUFFER) \
Local<Function> NG_JS_BUFFER = Local<Function>::Cast( \
Context::GetCurrent()->Global()->Get( \
String::New("Buffer"))); \
\
Handle<Value> NG_JS_ARGS[3] = { \
NG_SLOW_BUFFER->handle_, \
Integer::New(Buffer::Length(NG_SLOW_BUFFER)), \
Integer::New(0) \
}; \
\
NG_FAST_BUFFER = NG_JS_BUFFER->NewInstance(3, NG_JS_ARGS);
#endif
Jump to Line
Something went wrong with that request. Please try again.