From 5fab0fd188242f08431dee0bff62a3028d262b6d Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Sat, 26 Nov 2016 02:48:11 +0100 Subject: Added RO mode to permdb --- c_src/permdbpy.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'c_src/permdbpy.c') diff --git a/c_src/permdbpy.c b/c_src/permdbpy.c index 9bd2e8a..491f759 100644 --- a/c_src/permdbpy.c +++ b/c_src/permdbpy.c @@ -43,11 +43,11 @@ PyTypeObject permdb_type = { }; permdb_object_py * -permdb_alloc_py(const char *dbpath) +permdb_alloc_py(const char *dbpath, int write_enable) { struct permdb_object *permdb; - permdb = permdb_alloc(dbpath); + permdb = permdb_alloc(dbpath, write_enable); if (permdb == NULL) { PyErr_SetString(PyExc_RuntimeError, "Cannot allocate permdb object"); @@ -84,12 +84,13 @@ static PyObject * permdb_alloc_wrapper(PyObject *self, PyObject *args) { const char *dbpath = NULL; + int write_enable = 1; - if (!PyArg_ParseTuple(args, "s", &dbpath)) { + if (!PyArg_ParseTuple(args, "s|i", &dbpath, &write_enable)) { return NULL; } - return (PyObject*)permdb_alloc_py(dbpath); + return (PyObject*)permdb_alloc_py(dbpath, write_enable); } static PyObject * -- cgit v1.1