diff options
Diffstat (limited to 'Modules/_bsddb.c')
-rw-r--r-- | Modules/_bsddb.c | 346 |
1 files changed, 173 insertions, 173 deletions
diff --git a/Modules/_bsddb.c b/Modules/_bsddb.c index 2dd3000..5266a2c 100644 --- a/Modules/_bsddb.c +++ b/Modules/_bsddb.c @@ -143,9 +143,9 @@ typedef int Py_ssize_t; /* and these are for calling C --> Python */ #if defined(MYDB_USE_GILSTATE) #define MYDB_BEGIN_BLOCK_THREADS \ - PyGILState_STATE __savestate = PyGILState_Ensure(); + PyGILState_STATE __savestate = PyGILState_Ensure(); #define MYDB_END_BLOCK_THREADS \ - PyGILState_Release(__savestate); + PyGILState_Release(__savestate); #else /* MYDB_USE_GILSTATE */ /* Pre GILState API - do it the long old way */ static PyInterpreterState* _db_interpreterState = NULL; @@ -221,7 +221,7 @@ static PyObject* DBForeignConflictError; /* DB_FOREIGN_CONFLICT */ static PyObject* DBRepUnavailError; /* DB_REP_UNAVAIL */ #if (DBVER < 43) -#define DB_BUFFER_SMALL ENOMEM +#define DB_BUFFER_SMALL ENOMEM #endif #if (DBVER < 48) @@ -554,7 +554,7 @@ unsigned int our_strlcpy(char* dest, const char* src, unsigned int n) srclen = strlen(src); if (n <= 0) - return srclen; + return srclen; copylen = (srclen > n-1) ? n-1 : srclen; /* populate dest[0] thru dest[copylen-1] */ memcpy(dest, src, copylen); @@ -571,7 +571,7 @@ static char _db_errmsg[1024]; static void _db_errorCallback(const char* prefix, char* msg) #else static void _db_errorCallback(const DB_ENV *db_env, - const char* prefix, const char* msg) + const char* prefix, const char* msg) #endif { our_strlcpy(_db_errmsg, msg, sizeof(_db_errmsg)); @@ -703,8 +703,8 @@ static int makeDBError(int err) case DB_BUFFER_SMALL: errObj = DBNoMemoryError; break; #if (DBVER >= 43) - /* ENOMEM and DB_BUFFER_SMALL were one and the same until 4.3 */ - case ENOMEM: errObj = PyExc_MemoryError; break; + /* ENOMEM and DB_BUFFER_SMALL were one and the same until 4.3 */ + case ENOMEM: errObj = PyExc_MemoryError; break; #endif case EINVAL: errObj = DBInvalidArgError; break; case EACCES: errObj = DBAccessError; break; @@ -818,7 +818,7 @@ static int _DB_put(DBObject* self, DB_TXN *txn, DBT *key, DBT *data, int flags) /* Get a key/data pair from a cursor */ static PyObject* _DBCursor_get(DBCursorObject* self, int extra_flags, - PyObject *args, PyObject *kwargs, char *format) + PyObject *args, PyObject *kwargs, char *format) { int err; PyObject* retval = NULL; @@ -829,7 +829,7 @@ static PyObject* _DBCursor_get(DBCursorObject* self, int extra_flags, static char* kwnames[] = { "flags", "dlen", "doff", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, format, kwnames, - &flags, &dlen, &doff)) + &flags, &dlen, &doff)) return NULL; CHECK_CURSOR_NOT_CLOSED(self); @@ -845,7 +845,7 @@ static PyObject* _DBCursor_get(DBCursorObject* self, int extra_flags, MYDB_END_ALLOW_THREADS; if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->mydb->moduleFlags.getReturnsNone) { + && self->mydb->moduleFlags.getReturnsNone) { Py_INCREF(Py_None); retval = Py_None; } @@ -889,13 +889,13 @@ static void _addIntToDict(PyObject* dict, char *name, int value) static void _addTimeTToDict(PyObject* dict, char *name, time_t value) { PyObject* v; - /* if the value fits in regular int, use that. */ + /* if the value fits in regular int, use that. */ #ifdef PY_LONG_LONG - if (sizeof(time_t) > sizeof(long)) - v = PyLong_FromLongLong((PY_LONG_LONG) value); - else + if (sizeof(time_t) > sizeof(long)) + v = PyLong_FromLongLong((PY_LONG_LONG) value); + else #endif - v = NUMBER_FromLong((long) value); + v = NUMBER_FromLong((long) value); if (!v || PyDict_SetItemString(dict, name, v)) PyErr_Clear(); @@ -1044,10 +1044,10 @@ newDBCursorObject(DBC* dbc, DBTxnObject *txn, DBObject* db) INSERT_IN_DOUBLE_LINKED_LIST(self->mydb->children_cursors,self); if (txn && ((PyObject *)txn!=Py_None)) { - INSERT_IN_DOUBLE_LINKED_LIST_TXN(txn->children_cursors,self); - self->txn=txn; + INSERT_IN_DOUBLE_LINKED_LIST_TXN(txn->children_cursors,self); + self->txn=txn; } else { - self->txn=NULL; + self->txn=NULL; } self->in_weakreflist = NULL; @@ -1474,16 +1474,16 @@ _db_associateCallback(DB* db, const DBT* priKey, const DBT* priData, PyBytes_AsStringAndSize(result, &data, &size); secKey->flags = DB_DBT_APPMALLOC; /* DB will free */ secKey->data = malloc(size); /* TODO, check this */ - if (secKey->data) { - memcpy(secKey->data, data, size); - secKey->size = size; - retval = 0; - } - else { - PyErr_SetString(PyExc_MemoryError, + if (secKey->data) { + memcpy(secKey->data, data, size); + secKey->size = size; + retval = 0; + } + else { + PyErr_SetString(PyExc_MemoryError, "malloc failed in _db_associateCallback"); - PyErr_Print(); - } + PyErr_Print(); + } } #if (DBVER >= 46) else if (PyList_Check(result)) @@ -1615,7 +1615,7 @@ DB_associate(DBObject* self, PyObject* args, PyObject* kwargs) #endif MYDB_BEGIN_ALLOW_THREADS; err = self->db->associate(self->db, - txn, + txn, secondaryDB->db, _db_associateCallback, flags); @@ -1727,7 +1727,7 @@ _DB_consume(DBObject* self, PyObject* args, PyObject* kwargs, int consume_flag) MYDB_END_ALLOW_THREADS; if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->moduleFlags.getReturnsNone) { + && self->moduleFlags.getReturnsNone) { err = 0; Py_INCREF(Py_None); retval = Py_None; @@ -1981,7 +1981,7 @@ DB_get(DBObject* self, PyObject* args, PyObject* kwargs) retval = dfltobj; } else if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->moduleFlags.getReturnsNone) { + && self->moduleFlags.getReturnsNone) { err = 0; Py_INCREF(Py_None); retval = Py_None; @@ -2050,7 +2050,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs) retval = dfltobj; } else if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->moduleFlags.getReturnsNone) { + && self->moduleFlags.getReturnsNone) { err = 0; Py_INCREF(Py_None); retval = Py_None; @@ -2185,7 +2185,7 @@ DB_get_both(DBObject* self, PyObject* args, PyObject* kwargs) MYDB_END_ALLOW_THREADS; if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->moduleFlags.getReturnsNone) { + && self->moduleFlags.getReturnsNone) { err = 0; Py_INCREF(Py_None); retval = Py_None; @@ -2341,17 +2341,17 @@ DB_open(DBObject* self, PyObject* args, PyObject* kwargs) "filename", "dbtype", "flags", "mode", "txn", NULL}; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "z|ziiiO:open", kwnames, - &filename, &dbname, &type, &flags, &mode, + &filename, &dbname, &type, &flags, &mode, &txnobj)) { - PyErr_Clear(); - type = DB_UNKNOWN; flags = 0; mode = 0660; - filename = NULL; dbname = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwargs,"z|iiiO:open", + PyErr_Clear(); + type = DB_UNKNOWN; flags = 0; mode = 0660; + filename = NULL; dbname = NULL; + if (!PyArg_ParseTupleAndKeywords(args, kwargs,"z|iiiO:open", kwnames_basic, - &filename, &type, &flags, &mode, + &filename, &type, &flags, &mode, &txnobj)) - return NULL; + return NULL; } if (!checkTxnObj(txnobj, &txn)) return NULL; @@ -2607,20 +2607,20 @@ DB_get_bt_minkey(DBObject* self) static int _default_cmp(const DBT *leftKey, - const DBT *rightKey) + const DBT *rightKey) { int res; int lsize = leftKey->size, rsize = rightKey->size; res = memcmp(leftKey->data, rightKey->data, - lsize < rsize ? lsize : rsize); + lsize < rsize ? lsize : rsize); if (res == 0) { if (lsize < rsize) { - res = -1; + res = -1; } else if (lsize > rsize) { - res = 1; + res = 1; } } return res; @@ -2628,8 +2628,8 @@ _default_cmp(const DBT *leftKey, static int _db_compareCallback(DB* db, - const DBT *leftKey, - const DBT *rightKey) + const DBT *leftKey, + const DBT *rightKey) { int res = 0; PyObject *args; @@ -2637,40 +2637,40 @@ _db_compareCallback(DB* db, DBObject *self = (DBObject *)db->app_private; if (self == NULL || self->btCompareCallback == NULL) { - MYDB_BEGIN_BLOCK_THREADS; - PyErr_SetString(PyExc_TypeError, - (self == 0 - ? "DB_bt_compare db is NULL." - : "DB_bt_compare callback is NULL.")); - /* we're in a callback within the DB code, we can't raise */ - PyErr_Print(); - res = _default_cmp(leftKey, rightKey); - MYDB_END_BLOCK_THREADS; + MYDB_BEGIN_BLOCK_THREADS; + PyErr_SetString(PyExc_TypeError, + (self == 0 + ? "DB_bt_compare db is NULL." + : "DB_bt_compare callback is NULL.")); + /* we're in a callback within the DB code, we can't raise */ + PyErr_Print(); + res = _default_cmp(leftKey, rightKey); + MYDB_END_BLOCK_THREADS; } else { - MYDB_BEGIN_BLOCK_THREADS; - - args = BuildValue_SS(leftKey->data, leftKey->size, rightKey->data, rightKey->size); - if (args != NULL) { - result = PyEval_CallObject(self->btCompareCallback, args); - } - if (args == NULL || result == NULL) { - /* we're in a callback within the DB code, we can't raise */ - PyErr_Print(); - res = _default_cmp(leftKey, rightKey); - } else if (NUMBER_Check(result)) { - res = NUMBER_AsLong(result); - } else { - PyErr_SetString(PyExc_TypeError, - "DB_bt_compare callback MUST return an int."); - /* we're in a callback within the DB code, we can't raise */ - PyErr_Print(); - res = _default_cmp(leftKey, rightKey); - } - - Py_XDECREF(args); - Py_XDECREF(result); - - MYDB_END_BLOCK_THREADS; + MYDB_BEGIN_BLOCK_THREADS; + + args = BuildValue_SS(leftKey->data, leftKey->size, rightKey->data, rightKey->size); + if (args != NULL) { + result = PyEval_CallObject(self->btCompareCallback, args); + } + if (args == NULL || result == NULL) { + /* we're in a callback within the DB code, we can't raise */ + PyErr_Print(); + res = _default_cmp(leftKey, rightKey); + } else if (NUMBER_Check(result)) { + res = NUMBER_AsLong(result); + } else { + PyErr_SetString(PyExc_TypeError, + "DB_bt_compare callback MUST return an int."); + /* we're in a callback within the DB code, we can't raise */ + PyErr_Print(); + res = _default_cmp(leftKey, rightKey); + } + + Py_XDECREF(args); + Py_XDECREF(result); + + MYDB_END_BLOCK_THREADS; } return res; } @@ -2684,8 +2684,8 @@ DB_set_bt_compare(DBObject* self, PyObject* comparator) CHECK_DB_NOT_CLOSED(self); if (!PyCallable_Check(comparator)) { - makeTypeError("Callable", comparator); - return NULL; + makeTypeError("Callable", comparator); + return NULL; } /* @@ -2699,15 +2699,15 @@ DB_set_bt_compare(DBObject* self, PyObject* comparator) if (result == NULL) return NULL; if (!NUMBER_Check(result)) { - Py_DECREF(result); - PyErr_SetString(PyExc_TypeError, - "callback MUST return an int"); - return NULL; + Py_DECREF(result); + PyErr_SetString(PyExc_TypeError, + "callback MUST return an int"); + return NULL; } else if (NUMBER_AsLong(result) != 0) { - Py_DECREF(result); - PyErr_SetString(PyExc_TypeError, - "callback failed to return 0 on two empty strings"); - return NULL; + Py_DECREF(result); + PyErr_SetString(PyExc_TypeError, + "callback failed to return 0 on two empty strings"); + return NULL; } Py_DECREF(result); @@ -2715,8 +2715,8 @@ DB_set_bt_compare(DBObject* self, PyObject* comparator) * simplify the code. This would have no real use, as one cannot * change the function once the db is opened anyway */ if (self->btCompareCallback != NULL) { - PyErr_SetString(PyExc_RuntimeError, "set_bt_compare() cannot be called more than once"); - return NULL; + PyErr_SetString(PyExc_RuntimeError, "set_bt_compare() cannot be called more than once"); + return NULL; } Py_INCREF(comparator); @@ -2731,9 +2731,9 @@ DB_set_bt_compare(DBObject* self, PyObject* comparator) err = self->db->set_bt_compare(self->db, _db_compareCallback); if (err) { - /* restore the old state in case of error */ - Py_DECREF(comparator); - self->btCompareCallback = NULL; + /* restore the old state in case of error */ + Py_DECREF(comparator); + self->btCompareCallback = NULL; } RETURN_IF_ERR(); @@ -3315,8 +3315,8 @@ DB_verify(DBObject* self, PyObject* args, PyObject* kwargs) CHECK_DB_NOT_CLOSED(self); if (outFileName) outFile = fopen(outFileName, "w"); - /* XXX(nnorwitz): it should probably be an exception if outFile - can't be opened. */ + /* XXX(nnorwitz): it should probably be an exception if outFile + can't be opened. */ { /* DB.verify acts as a DB handle destructor (like close) */ PyObject *error; @@ -3369,8 +3369,8 @@ DB_set_encrypt(DBObject* self, PyObject* args, PyObject* kwargs) static char* kwnames[] = { "passwd", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|i:set_encrypt", kwnames, - &passwd, &flags)) { - return NULL; + &passwd, &flags)) { + return NULL; } MYDB_BEGIN_ALLOW_THREADS; @@ -3990,12 +3990,12 @@ DBC_get(DBCursorObject* self, PyObject* args, PyObject *kwargs) CLEAR_DBT(key); CLEAR_DBT(data); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|ii:get", &kwnames[2], - &flags, &dlen, &doff)) + &flags, &dlen, &doff)) { PyErr_Clear(); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi|ii:get", &kwnames[1], - &keyobj, &flags, &dlen, &doff)) + &keyobj, &flags, &dlen, &doff)) { PyErr_Clear(); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOi|ii:get", @@ -4003,8 +4003,8 @@ DBC_get(DBCursorObject* self, PyObject* args, PyObject *kwargs) &flags, &dlen, &doff)) { return NULL; - } - } + } + } } CHECK_CURSOR_NOT_CLOSED(self); @@ -4023,7 +4023,7 @@ DBC_get(DBCursorObject* self, PyObject* args, PyObject *kwargs) MYDB_END_ALLOW_THREADS; if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->mydb->moduleFlags.getReturnsNone) { + && self->mydb->moduleFlags.getReturnsNone) { Py_INCREF(Py_None); retval = Py_None; } @@ -4066,12 +4066,12 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs) CLEAR_DBT(key); CLEAR_DBT(data); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|ii:pget", &kwnames[2], - &flags, &dlen, &doff)) + &flags, &dlen, &doff)) { PyErr_Clear(); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oi|ii:pget", kwnames_keyOnly, - &keyobj, &flags, &dlen, &doff)) + &keyobj, &flags, &dlen, &doff)) { PyErr_Clear(); if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OOi|ii:pget", @@ -4079,8 +4079,8 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs) &flags, &dlen, &doff)) { return NULL; - } - } + } + } } CHECK_CURSOR_NOT_CLOSED(self); @@ -4101,7 +4101,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs) MYDB_END_ALLOW_THREADS; if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->mydb->moduleFlags.getReturnsNone) { + && self->mydb->moduleFlags.getReturnsNone) { Py_INCREF(Py_None); retval = Py_None; } @@ -4212,7 +4212,7 @@ DBC_put(DBCursorObject* self, PyObject* args, PyObject* kwargs) int doff = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "OO|iii:put", kwnames, - &keyobj, &dataobj, &flags, &dlen, &doff)) + &keyobj, &dataobj, &flags, &dlen, &doff)) return NULL; CHECK_CURSOR_NOT_CLOSED(self); @@ -4246,7 +4246,7 @@ DBC_set(DBCursorObject* self, PyObject* args, PyObject *kwargs) int doff = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|iii:set", kwnames, - &keyobj, &flags, &dlen, &doff)) + &keyobj, &flags, &dlen, &doff)) return NULL; CHECK_CURSOR_NOT_CLOSED(self); @@ -4264,7 +4264,7 @@ DBC_set(DBCursorObject* self, PyObject* args, PyObject *kwargs) err = _DBC_get(self->dbc, &key, &data, flags|DB_SET); MYDB_END_ALLOW_THREADS; if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->mydb->moduleFlags.cursorSetReturnsNone) { + && self->mydb->moduleFlags.cursorSetReturnsNone) { Py_INCREF(Py_None); retval = Py_None; } @@ -4309,7 +4309,7 @@ DBC_set_range(DBCursorObject* self, PyObject* args, PyObject* kwargs) int doff = -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|iii:set_range", kwnames, - &keyobj, &flags, &dlen, &doff)) + &keyobj, &flags, &dlen, &doff)) return NULL; CHECK_CURSOR_NOT_CLOSED(self); @@ -4326,7 +4326,7 @@ DBC_set_range(DBCursorObject* self, PyObject* args, PyObject* kwargs) err = _DBC_get(self->dbc, &key, &data, flags|DB_SET_RANGE); MYDB_END_ALLOW_THREADS; if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->mydb->moduleFlags.cursorSetReturnsNone) { + && self->mydb->moduleFlags.cursorSetReturnsNone) { Py_INCREF(Py_None); retval = Py_None; } @@ -4480,7 +4480,7 @@ DBC_set_recno(DBCursorObject* self, PyObject* args, PyObject *kwargs) static char* kwnames[] = { "recno","flags", "dlen", "doff", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|iii:set_recno", kwnames, - &irecno, &flags, &dlen, &doff)) + &irecno, &flags, &dlen, &doff)) return NULL; CHECK_CURSOR_NOT_CLOSED(self); @@ -4509,7 +4509,7 @@ DBC_set_recno(DBCursorObject* self, PyObject* args, PyObject *kwargs) err = _DBC_get(self->dbc, &key, &data, flags|DB_SET_RECNO); MYDB_END_ALLOW_THREADS; if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->mydb->moduleFlags.cursorSetReturnsNone) { + && self->mydb->moduleFlags.cursorSetReturnsNone) { Py_INCREF(Py_None); retval = Py_None; } @@ -4579,7 +4579,7 @@ DBC_join_item(DBCursorObject* self, PyObject* args) err = _DBC_get(self->dbc, &key, &data, flags | DB_JOIN_ITEM); MYDB_END_ALLOW_THREADS; if ((err == DB_NOTFOUND || err == DB_KEYEMPTY) - && self->mydb->moduleFlags.getReturnsNone) { + && self->mydb->moduleFlags.getReturnsNone) { Py_INCREF(Py_None); retval = Py_None; } @@ -4602,7 +4602,7 @@ DBC_set_priority(DBCursorObject* self, PyObject* args, PyObject* kwargs) static char* kwnames[] = { "priority", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i:set_priority", kwnames, - &priority)) + &priority)) return NULL; CHECK_CURSOR_NOT_CLOSED(self); @@ -4921,8 +4921,8 @@ DBEnv_dbremove(DBEnvObject* self, PyObject* args, PyObject* kwargs) NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|zOi:dbremove", kwnames, - &file, &database, &txnobj, &flags)) { - return NULL; + &file, &database, &txnobj, &flags)) { + return NULL; } if (!checkTxnObj(txnobj, &txn)) { return NULL; @@ -4949,8 +4949,8 @@ DBEnv_dbrename(DBEnvObject* self, PyObject* args, PyObject* kwargs) "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "szs|Oi:dbrename", kwnames, - &file, &database, &newname, &txnobj, &flags)) { - return NULL; + &file, &database, &newname, &txnobj, &flags)) { + return NULL; } if (!checkTxnObj(txnobj, &txn)) { return NULL; @@ -4975,8 +4975,8 @@ DBEnv_set_encrypt(DBEnvObject* self, PyObject* args, PyObject* kwargs) static char* kwnames[] = { "passwd", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|i:set_encrypt", kwnames, - &passwd, &flags)) { - return NULL; + &passwd, &flags)) { + return NULL; } MYDB_BEGIN_ALLOW_THREADS; @@ -5037,8 +5037,8 @@ DBEnv_set_timeout(DBEnvObject* self, PyObject* args, PyObject* kwargs) static char* kwnames[] = { "timeout", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:set_timeout", kwnames, - &timeout, &flags)) { - return NULL; + &timeout, &flags)) { + return NULL; } MYDB_BEGIN_ALLOW_THREADS; @@ -6935,8 +6935,8 @@ DBEnv_set_event_notify(DBEnvObject* self, PyObject* notifyFunc) CHECK_ENV_NOT_CLOSED(self); if (!PyCallable_Check(notifyFunc)) { - makeTypeError("Callable", notifyFunc); - return NULL; + makeTypeError("Callable", notifyFunc); + return NULL; } Py_XDECREF(self->event_notifyCallback); @@ -6954,8 +6954,8 @@ DBEnv_set_event_notify(DBEnvObject* self, PyObject* notifyFunc) MYDB_END_ALLOW_THREADS; if (err) { - Py_DECREF(notifyFunc); - self->event_notifyCallback = NULL; + Py_DECREF(notifyFunc); + self->event_notifyCallback = NULL; } RETURN_IF_ERR(); @@ -7276,7 +7276,7 @@ DBEnv_rep_start(DBEnvObject* self, PyObject* args, PyObject* kwargs) if (!PyArg_ParseTupleAndKeywords(args, kwargs, "i|O:rep_start", kwnames, &flags, &cdata_py)) { - return NULL; + return NULL; } CHECK_ENV_NOT_CLOSED(self); @@ -7598,7 +7598,7 @@ DBEnv_repmgr_start(DBEnvObject* self, PyObject* args, PyObject* if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:repmgr_start", kwnames, &nthreads, &flags)) { - return NULL; + return NULL; } CHECK_ENV_NOT_CLOSED(self); MYDB_BEGIN_ALLOW_THREADS; @@ -7621,7 +7621,7 @@ DBEnv_repmgr_set_local_site(DBEnvObject* self, PyObject* args, PyObject* if (!PyArg_ParseTupleAndKeywords(args, kwargs, "si|i:repmgr_set_local_site", kwnames, &host, &port, &flags)) { - return NULL; + return NULL; } CHECK_ENV_NOT_CLOSED(self); MYDB_BEGIN_ALLOW_THREADS; @@ -7645,7 +7645,7 @@ DBEnv_repmgr_add_remote_site(DBEnvObject* self, PyObject* args, PyObject* if (!PyArg_ParseTupleAndKeywords(args, kwargs, "si|i:repmgr_add_remote_site", kwnames, &host, &port, &flags)) { - return NULL; + return NULL; } CHECK_ENV_NOT_CLOSED(self); MYDB_BEGIN_ALLOW_THREADS; @@ -7663,7 +7663,7 @@ DBEnv_repmgr_set_ack_policy(DBEnvObject* self, PyObject* args) if (!PyArg_ParseTuple(args, "i:repmgr_set_ack_policy", &ack_policy)) { - return NULL; + return NULL; } CHECK_ENV_NOT_CLOSED(self); MYDB_BEGIN_ALLOW_THREADS; @@ -7838,7 +7838,7 @@ static void _promote_transaction_dbs_and_sequences(DBTxnObject *txn) /* The db is already linked to its environment, ** so nothing to do. */ - db->txn=NULL; + db->txn=NULL; } } @@ -8034,8 +8034,8 @@ DBTxn_set_timeout(DBTxnObject* self, PyObject* args, PyObject* kwargs) static char* kwnames[] = { "timeout", "flags", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ii:set_timeout", kwnames, - &timeout, &flags)) { - return NULL; + &timeout, &flags)) { + return NULL; } MYDB_BEGIN_ALLOW_THREADS; @@ -8963,20 +8963,20 @@ statichere PyTypeObject DB_Type = { &DB_sequence,/*tp_as_sequence*/ &DB_mapping,/*tp_as_mapping*/ 0, /*tp_hash*/ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ 0, /* tp_setattro */ - 0, /* tp_as_buffer */ + 0, /* tp_as_buffer */ #if (PY_VERSION_HEX < 0x03000000) Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ #else Py_TPFLAGS_DEFAULT, /* tp_flags */ #endif 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ offsetof(DBObject, in_weakreflist), /* tp_weaklistoffset */ 0, /*tp_iter*/ 0, /*tp_iternext*/ @@ -9092,20 +9092,20 @@ statichere PyTypeObject DBEnv_Type = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ 0, /* tp_setattro */ - 0, /* tp_as_buffer */ + 0, /* tp_as_buffer */ #if (PY_VERSION_HEX < 0x03000000) Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ #else Py_TPFLAGS_DEFAULT, /* tp_flags */ #endif 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ offsetof(DBEnvObject, in_weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ @@ -9135,20 +9135,20 @@ statichere PyTypeObject DBTxn_Type = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ 0, /* tp_setattro */ - 0, /* tp_as_buffer */ + 0, /* tp_as_buffer */ #if (PY_VERSION_HEX < 0x03000000) Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ #else Py_TPFLAGS_DEFAULT, /* tp_flags */ #endif 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ offsetof(DBTxnObject, in_weakreflist), /* tp_weaklistoffset */ 0, /*tp_iter*/ 0, /*tp_iternext*/ @@ -9178,20 +9178,20 @@ statichere PyTypeObject DBLock_Type = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ 0, /* tp_setattro */ - 0, /* tp_as_buffer */ + 0, /* tp_as_buffer */ #if (PY_VERSION_HEX < 0x03000000) Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ #else Py_TPFLAGS_DEFAULT, /* tp_flags */ #endif 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ offsetof(DBLockObject, in_weakreflist), /* tp_weaklistoffset */ }; @@ -9217,20 +9217,20 @@ statichere PyTypeObject DBSequence_Type = { 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ 0, /* tp_setattro */ - 0, /* tp_as_buffer */ + 0, /* tp_as_buffer */ #if (PY_VERSION_HEX < 0x03000000) Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ #else Py_TPFLAGS_DEFAULT, /* tp_flags */ #endif 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ offsetof(DBSequenceObject, in_weakreflist), /* tp_weaklistoffset */ 0, /*tp_iter*/ 0, /*tp_iternext*/ @@ -9404,7 +9404,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ #if (PY_VERSION_HEX < 0x03000000) return; #else - return NULL; + return NULL; #endif } @@ -9878,7 +9878,7 @@ PyMODINIT_FUNC PyInit__bsddb(void) /* Note the two underscores */ * using one base class. */ PyDict_SetItemString(d, "KeyError", PyExc_KeyError); PyRun_String("class DBNotFoundError(DBError, KeyError): pass\n" - "class DBKeyEmptyError(DBError, KeyError): pass", + "class DBKeyEmptyError(DBError, KeyError): pass", Py_file_input, d, d); DBNotFoundError = PyDict_GetItemString(d, "DBNotFoundError"); DBKeyEmptyError = PyDict_GetItemString(d, "DBKeyEmptyError"); |