clean code
This commit is contained in:
parent
ea474dbb62
commit
2ccaa44f2f
1 changed files with 3 additions and 4 deletions
|
@ -10,13 +10,12 @@
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#define NODE_CURL_OPTION_NX(name, value) {#name, value}
|
|
||||||
#define NODE_CURL_OPTION(name) NODE_CURL_OPTION_NX(name , CURLOPT_##name)
|
|
||||||
#define NODE_CURL_EXPORT(name) export_curl_options(t, #name, name, sizeof(name) / sizeof(CurlOption));
|
#define NODE_CURL_EXPORT(name) export_curl_options(t, #name, name, sizeof(name) / sizeof(CurlOption));
|
||||||
|
|
||||||
class NodeCurl
|
class NodeCurl
|
||||||
{
|
{
|
||||||
struct CurlOption {
|
struct CurlOption
|
||||||
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
int value;
|
int value;
|
||||||
};
|
};
|
||||||
|
@ -31,11 +30,11 @@ class NodeCurl
|
||||||
v8::Persistent<v8::Object> handle;
|
v8::Persistent<v8::Object> handle;
|
||||||
bool in_curlm;
|
bool in_curlm;
|
||||||
std::vector<curl_slist*> slists;
|
std::vector<curl_slist*> slists;
|
||||||
|
|
||||||
NodeCurl(v8::Handle<v8::Object> object)
|
NodeCurl(v8::Handle<v8::Object> object)
|
||||||
: in_curlm(false)
|
: in_curlm(false)
|
||||||
{
|
{
|
||||||
++count;
|
++count;
|
||||||
// I know 2*4096 is magical world, but I have no idea the real memory curl will occupied
|
|
||||||
v8::V8::AdjustAmountOfExternalAllocatedMemory(2*4096);
|
v8::V8::AdjustAmountOfExternalAllocatedMemory(2*4096);
|
||||||
object->SetPointerInInternalField(0, this);
|
object->SetPointerInInternalField(0, this);
|
||||||
handle = v8::Persistent<v8::Object>::New(object);
|
handle = v8::Persistent<v8::Object>::New(object);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue