Browse Source

move global vars for node_file.cc, node_zlib.cc, and node_crypto.cc

v0.7.4-release
Ryan Dahl 13 years ago
parent
commit
e53e9c72cb
  1. 38
      src/node_crypto.cc
  2. 45
      src/node_file.cc
  3. 35
      src/node_vars.h
  4. 6
      src/node_zlib.cc

38
src/node_crypto.cc

@ -56,35 +56,39 @@
static const char PUBLIC_KEY_PFX[] = "-----BEGIN PUBLIC KEY-----";
static const int PUBLIC_KEY_PFX_LEN = sizeof(PUBLIC_KEY_PFX) - 1;
static const char PUBRSA_KEY_PFX[] = "-----BEGIN RSA PUBLIC KEY-----";
static const int PUBRSA_KEY_PFX_LEN = sizeof(PUBRSA_KEY_PFX) - 1;
static const int X509_NAME_FLAGS = ASN1_STRFLGS_ESC_CTRL
| ASN1_STRFLGS_ESC_MSB
| XN_FLAG_SEP_MULTILINE
| XN_FLAG_FN_SN;
#include <node_vars.h>
// We do the following to minimize the detal between v0.6 branch. We want to
// use the variables as they were being used before.
#define on_headers_sym NODE_VAR(on_headers_sym)
#define errno_symbol NODE_VAR(errno_symbol)
#define syscall_symbol NODE_VAR(syscall_symbol)
#define subject_symbol NODE_VAR(subject_symbol)
#define subjectaltname_symbol NODE_VAR(subjectaltname_symbol)
#define modulus_symbol NODE_VAR(modulus_symbol)
#define exponent_symbol NODE_VAR(exponent_symbol)
#define issuer_symbol NODE_VAR(issuer_symbol)
#define valid_from_symbol NODE_VAR(valid_from_symbol)
#define valid_to_symbol NODE_VAR(valid_to_symbol)
#define fingerprint_symbol NODE_VAR(fingerprint_symbol)
#define name_symbol NODE_VAR(name_symbol)
#define version_symbol NODE_VAR(version_symbol)
#define ext_key_usage_symbol NODE_VAR(ext_key_usage_symbol)
#define secure_context_constructor NODE_VAR(secure_context_constructor)
namespace node {
namespace crypto {
using namespace v8;
static Persistent<String> errno_symbol;
static Persistent<String> syscall_symbol;
static Persistent<String> subject_symbol;
static Persistent<String> subjectaltname_symbol;
static Persistent<String> modulus_symbol;
static Persistent<String> exponent_symbol;
static Persistent<String> issuer_symbol;
static Persistent<String> valid_from_symbol;
static Persistent<String> valid_to_symbol;
static Persistent<String> fingerprint_symbol;
static Persistent<String> name_symbol;
static Persistent<String> version_symbol;
static Persistent<String> ext_key_usage_symbol;
static Persistent<FunctionTemplate> secure_context_constructor;
static unsigned long crypto_id_cb(void) {
#ifdef _WIN32

45
src/node_file.cc

@ -41,6 +41,30 @@
#endif
#include <node_vars.h>
// We do the following to minimize the detal between v0.6 branch. We want to
// use the variables as they were being used before.
#define on_headers_sym NODE_VAR(on_headers_sym)
#define encoding_symbol NODE_VAR(encoding_symbol)
#define errno_symbol NODE_VAR(errno_symbol)
#define buf_symbol NODE_VAR(buf_symbol)
#define oncomplete_sym NODE_VAR(oncomplete_sym)
#define stats_constructor_template NODE_VAR(stats_constructor_template)
#define dev_symbol NODE_VAR(dev_symbol)
#define ino_symbol NODE_VAR(ino_symbol)
#define mode_symbol NODE_VAR(mode_symbol)
#define nlink_symbol NODE_VAR(nlink_symbol)
#define uid_symbol NODE_VAR(uid_symbol)
#define gid_symbol NODE_VAR(gid_symbol)
#define rdev_symbol NODE_VAR(rdev_symbol)
#define size_symbol NODE_VAR(size_symbol)
#define blksize_symbol NODE_VAR(blksize_symbol)
#define blocks_symbol NODE_VAR(blocks_symbol)
#define atime_symbol NODE_VAR(atime_symbol)
#define mtime_symbol NODE_VAR(mtime_symbol)
#define ctime_symbol NODE_VAR(ctime_symbol)
namespace node {
using namespace v8;
@ -51,11 +75,6 @@ using namespace v8;
typedef class ReqWrap<uv_fs_t> FSReqWrap;
static Persistent<String> encoding_symbol;
static Persistent<String> errno_symbol;
static Persistent<String> buf_symbol;
static Persistent<String> oncomplete_sym;
#ifdef _LARGEFILE_SOURCE
static inline int IsInt64(double x) {
@ -245,22 +264,6 @@ static Handle<Value> Close(const Arguments& args) {
}
static Persistent<FunctionTemplate> stats_constructor_template;
static Persistent<String> dev_symbol;
static Persistent<String> ino_symbol;
static Persistent<String> mode_symbol;
static Persistent<String> nlink_symbol;
static Persistent<String> uid_symbol;
static Persistent<String> gid_symbol;
static Persistent<String> rdev_symbol;
static Persistent<String> size_symbol;
static Persistent<String> blksize_symbol;
static Persistent<String> blocks_symbol;
static Persistent<String> atime_symbol;
static Persistent<String> mtime_symbol;
static Persistent<String> ctime_symbol;
Local<Object> BuildStatsObject(NODE_STAT_STRUCT *s) {
HandleScope scope;

35
src/node_vars.h

@ -126,6 +126,41 @@ struct globals {
char* current_buffer_data;
size_t current_buffer_len;
// node_file.cc
v8::Persistent<v8::String> encoding_symbol;
v8::Persistent<v8::String> buf_symbol;
v8::Persistent<v8::String> oncomplete_sym;
v8::Persistent<v8::FunctionTemplate> stats_constructor_template;
v8::Persistent<v8::String> dev_symbol;
v8::Persistent<v8::String> ino_symbol;
v8::Persistent<v8::String> mode_symbol;
v8::Persistent<v8::String> nlink_symbol;
v8::Persistent<v8::String> uid_symbol;
v8::Persistent<v8::String> gid_symbol;
v8::Persistent<v8::String> rdev_symbol;
v8::Persistent<v8::String> size_symbol;
v8::Persistent<v8::String> blksize_symbol;
v8::Persistent<v8::String> blocks_symbol;
v8::Persistent<v8::String> atime_symbol;
v8::Persistent<v8::String> mtime_symbol;
v8::Persistent<v8::String> ctime_symbol;
// node_zlib.cc
v8::Persistent<v8::String> callback_sym;
// node_crypto.cc
v8::Persistent<v8::String> subject_symbol;
v8::Persistent<v8::String> subjectaltname_symbol;
v8::Persistent<v8::String> modulus_symbol;
v8::Persistent<v8::String> exponent_symbol;
v8::Persistent<v8::String> issuer_symbol;
v8::Persistent<v8::String> valid_from_symbol;
v8::Persistent<v8::String> valid_to_symbol;
v8::Persistent<v8::String> fingerprint_symbol;
v8::Persistent<v8::String> name_symbol;
v8::Persistent<v8::String> version_symbol;
v8::Persistent<v8::String> ext_key_usage_symbol;
v8::Persistent<v8::FunctionTemplate> secure_context_constructor;
};
struct globals* globals_get();

6
src/node_zlib.cc

@ -31,6 +31,10 @@
#include <node_buffer.h>
#include <req_wrap.h>
#include <node_vars.h>
// We do the following to minimize the detal between v0.6 branch. We want to
// use the variables as they were being used before.
#define callback_sym NODE_VAR(callback_sym)
namespace node {
@ -39,8 +43,6 @@ using namespace v8;
// write() returns one of these, and then calls the cb() when it's done.
typedef ReqWrap<uv_work_t> WorkReqWrap;
static Persistent<String> callback_sym;
enum node_zlib_mode {
DEFLATE = 1,
INFLATE,

Loading…
Cancel
Save