basho/eleveldb — pull request #113 by vinoski (2014-04-25 14:31:09+00:00)
Title: avoid badarg exception when closing db_refs being closed

DbObject::RetrieveDbObject() returns NULL for 2 cases: when the db_ref NIF
resource can't be retrieved, and when the "close requested" flag is already
set. But eleveldb_close() treats both NULL return cases as an error and
raises the badarg exception for both.

Modify DbObject::RetrieveDbObject() to add a defaulted third argument, a
pointer to bool that defaults to NULL. If non-NULL,
DbObject::RetrieveDbObject() sets the bool to true if the db_ref NIF
resource is successfully retrieved, false otherwise. This allows
eleveldb_close() to pass that bool argument and then use it to distinguish
between the two NULL return cases from DbObject::RetrieveDbObject().