[Pkg-javascript-commits] [node-leveldown] 247/492: LD_CB_ERR_IF_OPTION_NULL_OR_UNDEFINED -> LD_CB_ERR_IF_NULL_OR_UNDEFINED for args

Andrew Kelley andrewrk-guest at moszumanska.debian.org
Sun Jul 6 17:14:05 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 4ffd93a461372a7759b55af984bebc50a7e8a8f5
Author: Lars-Magnus Skog <lars.magnus.skog at gmail.com>
Date:   Sat Mar 9 08:51:28 2013 +0100

    LD_CB_ERR_IF_OPTION_NULL_OR_UNDEFINED -> LD_CB_ERR_IF_NULL_OR_UNDEFINED for args
---
 src/database.cc          | 12 ++++++------
 src/leveldown.h          |  3 ---
 test/put-get-del-test.js | 10 +++++-----
 3 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/src/database.cc b/src/database.cc
index 673592a..8f1b3e3 100644
--- a/src/database.cc
+++ b/src/database.cc
@@ -214,8 +214,8 @@ v8::Handle<v8::Value> Database::Put (const v8::Arguments& args) {
 
   LD_METHOD_SETUP_COMMON(put, 2, 3)
 
-  LD_CB_ERR_IF_OPTION_NULL_OR_UNDEFINED(0, Key)
-  LD_CB_ERR_IF_OPTION_NULL_OR_UNDEFINED(1, Value)
+  LD_CB_ERR_IF_NULL_OR_UNDEFINED(args[0], Key)
+  LD_CB_ERR_IF_NULL_OR_UNDEFINED(args[1], Value)
 
   v8::Local<v8::Value> keyBufferV = args[0];
   v8::Local<v8::Value> valueBufferV = args[1];
@@ -248,7 +248,7 @@ v8::Handle<v8::Value> Database::Get (const v8::Arguments& args) {
 
   LD_METHOD_SETUP_COMMON(put, 1, 2)
 
-  LD_CB_ERR_IF_OPTION_NULL_OR_UNDEFINED(0, Key)
+  LD_CB_ERR_IF_NULL_OR_UNDEFINED(args[0], Key)
 
   v8::Local<v8::Value> keyBufferV = args[0];
   LD_STRING_OR_BUFFER_TO_SLICE(key, keyBufferV, Key)
@@ -276,7 +276,7 @@ v8::Handle<v8::Value> Database::Delete (const v8::Arguments& args) {
 
   LD_METHOD_SETUP_COMMON(put, 1, 2)
 
-  LD_CB_ERR_IF_OPTION_NULL_OR_UNDEFINED(0, Key)
+  LD_CB_ERR_IF_NULL_OR_UNDEFINED(args[0], Key)
 
   v8::Local<v8::Value> keyBufferV = args[0];
   LD_STRING_OR_BUFFER_TO_SLICE(key, keyBufferV, Key)
@@ -379,8 +379,8 @@ v8::Handle<v8::Value> Database::ApproximateSize (const v8::Arguments& args) {
 
   LD_METHOD_SETUP_COMMON(approximateSize, -1, 2)
 
-  LD_CB_ERR_IF_OPTION_NULL_OR_UNDEFINED(0, Start)
-  LD_CB_ERR_IF_OPTION_NULL_OR_UNDEFINED(1, End)
+  LD_CB_ERR_IF_NULL_OR_UNDEFINED(args[0], Start)
+  LD_CB_ERR_IF_NULL_OR_UNDEFINED(args[1], End)
 
   LD_STRING_OR_BUFFER_TO_SLICE(start, startBufferV, Start)
   LD_STRING_OR_BUFFER_TO_SLICE(end, endBufferV, End)
diff --git a/src/leveldown.h b/src/leveldown.h
index 38e3fee..056a52e 100644
--- a/src/leveldown.h
+++ b/src/leveldown.h
@@ -23,9 +23,6 @@
     return v8::Undefined(); \
   }
 
-#define LD_CB_ERR_IF_OPTION_NULL_OR_UNDEFINED(index, name) \
-  LD_CB_ERR_IF_NULL_OR_UNDEFINED(args[index], name argument)
-
 #define LD_FROM_V8_STRING(to, from) \
   size_t to ## Sz_; \
   char* to; \
diff --git a/test/put-get-del-test.js b/test/put-get-del-test.js
index 4dc3f66..63b66d0 100644
--- a/test/put-get-del-test.js
+++ b/test/put-get-del-test.js
@@ -75,8 +75,8 @@ test('setUp', function (t) {
 
 /**** TEST ERROR KEYS ****/
 
-makeErrorKeyTest('null key', null, /Key argument cannot be `null` or `undefined`/)
-makeErrorKeyTest('undefined key', undefined, /Key argument cannot be `null` or `undefined`/)
+makeErrorKeyTest('null key', null, /Key cannot be `null` or `undefined`/)
+makeErrorKeyTest('undefined key', undefined, /Key cannot be `null` or `undefined`/)
 makeErrorKeyTest('empty String key', '', /Key argument cannot be an empty String/)
 makeErrorKeyTest('empty Buffer key', new Buffer(0), /Key argument cannot be an empty Buffer/)
 makeErrorKeyTest('empty Array key', [], /Key argument cannot be an empty String/)
@@ -103,8 +103,8 @@ makePutGetDelSuccessfulTest('Array value', 'foo', [1,2,3,4])
 
 /**** TEST ERROR VALUES ****/
 
-makePutErrorTest('null value', 'foo', null, /Value argument cannot be `null` or `undefined`/)
-makePutErrorTest('undefined value', 'foo', undefined, /Value argument cannot be `null` or `undefined`/)
+makePutErrorTest('null value', 'foo', null, /Value cannot be `null` or `undefined`/)
+makePutErrorTest('undefined value', 'foo', undefined, /Value cannot be `null` or `undefined`/)
 makePutErrorTest('empty String value', 'foo', '', /Value argument cannot be an empty String/)
 makePutErrorTest('empty Buffer value', 'foo', new Buffer(0), /Value argument cannot be an empty Buffer/)
 makePutErrorTest('empty Array value', 'foo', [], /Value argument cannot be an empty String/)
@@ -131,4 +131,4 @@ makePutGetDelSuccessfulTest('Array value', [1,2,3,4], 'foo')
 
 test('tearDown', function (t) {
   db.close(testCommon.tearDown.bind(null, t))
-})
\ No newline at end of file
+})

-- 
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