[Pkg-javascript-commits] [node-leveldown] 229/492: fix keyless batch(), symbol macros to LU_SYMBOL
Andrew Kelley
andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:14:02 UTC 2014
This is an automated email from the git hooks/post-receive script.
andrewrk-guest pushed a commit to annotated tag rocksdb-0.10.1
in repository node-leveldown.
commit 2d6c46645d24af8defa524a8568e53b5cd647553
Author: Rod Vagg <rod at vagg.org>
Date: Sat Feb 23 14:29:47 2013 +1100
fix keyless batch(), symbol macros to LU_SYMBOL
---
src/database.cc | 12 ++++++------
src/database.h | 14 +++++++-------
src/iterator.h | 16 ++++++++--------
src/leveldown.h | 10 +++-------
4 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/src/database.cc b/src/database.cc
index 72c994c..e2c2daf 100644
--- a/src/database.cc
+++ b/src/database.cc
@@ -293,11 +293,11 @@ v8::Handle<v8::Value> Database::Delete (const v8::Arguments& args) {
}
/* property key & value strings for elements of the array sent to batch() */
-LU_STR ( key );
-LU_STR ( value );
-LU_STR ( type );
-LU_STR ( del );
-LU_STR ( put );
+LU_SYMBOL ( str_key , key );
+LU_SYMBOL ( str_value , value );
+LU_SYMBOL ( str_type , type );
+LU_SYMBOL ( str_del , del );
+LU_SYMBOL ( str_put , put );
v8::Handle<v8::Value> Database::Batch (const v8::Arguments& args) {
v8::HandleScope scope;
@@ -314,7 +314,7 @@ v8::Handle<v8::Value> Database::Batch (const v8::Arguments& args) {
continue;
v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(array->Get(i));
- if (!obj->Has(str_type) && !obj->Has(str_key))
+ if (!obj->Has(str_type) || !obj->Has(str_key))
continue;
v8::Local<v8::Value> keyBuffer = obj->Get(str_key);
diff --git a/src/database.h b/src/database.h
index 23d833e..31768e6 100644
--- a/src/database.h
+++ b/src/database.h
@@ -14,13 +14,13 @@
namespace leveldown {
-LU_OPTION ( createIfMissing ); // for open()
-LU_OPTION ( errorIfExists ); // for open()
-LU_OPTION ( compression ); // for open()
-LU_OPTION ( cacheSize ); // for open()
-LU_OPTION ( sync ); // for put() and delete()
-LU_OPTION ( asBuffer ); // for get()
-LU_OPTION ( fillCache ); // for get() and readStream()
+LU_SYMBOL ( option_createIfMissing , createIfMissing ); // for open()
+LU_SYMBOL ( option_errorIfExists , errorIfExists ); // for open()
+LU_SYMBOL ( option_compression , compression ); // for open()
+LU_SYMBOL ( option_cacheSize , cacheSize ); // for open()
+LU_SYMBOL ( option_sync , sync ); // for put() and delete()
+LU_SYMBOL ( option_asBuffer , asBuffer ); // for get()
+LU_SYMBOL ( option_fillCache , fillcache ); // for get() and readStream()
struct AsyncDescriptor;
diff --git a/src/iterator.h b/src/iterator.h
index 6ce0af0..b44c913 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -14,14 +14,14 @@
namespace leveldown {
-LU_OPTION ( start );
-LU_OPTION ( end );
-LU_OPTION ( limit );
-LU_OPTION ( reverse );
-LU_OPTION ( keys );
-LU_OPTION ( values );
-LU_OPTION ( keyAsBuffer );
-LU_OPTION ( valueAsBuffer );
+LU_SYMBOL ( option_start , start );
+LU_SYMBOL ( option_end , end );
+LU_SYMBOL ( option_limit , limit );
+LU_SYMBOL ( option_reverse , reverse );
+LU_SYMBOL ( option_keys , keys );
+LU_SYMBOL ( option_values , values );
+LU_SYMBOL ( option_keyAsBuffer , keyAsBuffer );
+LU_SYMBOL ( option_valueAsBuffer , valueAsBuffer );
v8::Handle<v8::Value> CreateIterator (const v8::Arguments& args);
diff --git a/src/leveldown.h b/src/leveldown.h
index 7f1376d..93a3c63 100644
--- a/src/leveldown.h
+++ b/src/leveldown.h
@@ -6,13 +6,9 @@
#ifndef LU_LEVELDOWN_H
#define LU_LEVELDOWN_H
-#define LU_STR(key) \
- static const v8::Persistent<v8::String> str_ ## key = \
- v8::Persistent<v8::String>::New(v8::String::New(#key));
-
-#define LU_OPTION(key) \
- static const v8::Persistent<v8::String> option_ ## key = \
- v8::Persistent<v8::String>::New(v8::String::New(#key));
+#define LU_SYMBOL(var, key) \
+ static const v8::Persistent<v8::String> var = \
+ v8::Persistent<v8::String>::New(v8::String::NewSymbol(#key));
#define LU_V8_METHOD(name) \
static v8::Handle<v8::Value> name (const v8::Arguments& args);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-leveldown.git
More information about the Pkg-javascript-commits
mailing list