summaryrefslogtreecommitdiff
path: root/lib/ldb/pyldb.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ldb/pyldb.h')
-rw-r--r--lib/ldb/pyldb.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/ldb/pyldb.h b/lib/ldb/pyldb.h
index dbe1d0fdb9e..56e0f5e19c0 100644
--- a/lib/ldb/pyldb.h
+++ b/lib/ldb/pyldb.h
@@ -34,7 +34,13 @@ typedef struct {
struct ldb_context *ldb_ctx;
} PyLdbObject;
-#define pyldb_Ldb_AsLdbContext(pyobj) ((PyLdbObject *)pyobj)->ldb_ctx
+/* pyldb_Ldb_AS_LDBCONTEXT() does not check argument validity,
+ pyldb_Ldb_AsLdbContext() does */
+#define pyldb_Ldb_AS_LDBCONTEXT(pyobj) ((PyLdbObject *)pyobj)->ldb_ctx
+
+#define pyldb_Ldb_AsLdbContext(pyobj) \
+ (pyldb_check_type(pyobj, "Ldb") ? \
+ pyldb_Ldb_AS_LDBCONTEXT(pyobj) : NULL)
typedef struct {
PyObject_HEAD