dsdb: Use pyldb_Ldb_AsLdbContext() in PyErr_LDB_OR_RAISE()
authorAndrew Bartlett <abartlet@samba.org>
Mon, 4 Dec 2023 21:08:23 +0000 (10:08 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Sun, 3 Mar 2024 22:33:35 +0000 (22:33 +0000)
This macro already checks the type, so we do not need to call
py_check_dcerpc_type() and prepares to move this macro into pyldb.h

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source4/dsdb/pydsdb.c

index 7f77f2b78340dc3b85deaed608abed1bb7bdfde6..594d111f0ba73dd289aa7642096c746c5702bd44 100644 (file)
 
 /* FIXME: These should be in a header file somewhere */
 #define PyErr_LDB_OR_RAISE(py_ldb, ldb) \
-       if (!py_check_dcerpc_type(py_ldb, "ldb", "Ldb")) { \
+       ldb = pyldb_Ldb_AsLdbContext(py_ldb); \
+       if (!ldb) { \
                PyErr_SetString(PyExc_TypeError, "Ldb connection object required"); \
                return NULL; \
-       } \
-       ldb = pyldb_Ldb_AS_LDBCONTEXT(py_ldb);
+       }
 
 #define PyErr_LDB_DN_OR_RAISE(py_ldb_dn, dn) \
        if (!py_check_dcerpc_type(py_ldb_dn, "ldb", "Dn")) { \