FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/include/utils.h at v0.0.72 · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
21
(21)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
include
/
utils.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
19 lines (17 loc) · 919 Bytes
Breadcrumbs
nodegit
/
include
/
utils.h
Copy path
File metadata and controls
19 lines (17 loc) · 919 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#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
Back
|
FazBrowse Home
|
New Git URL