From 450fcf3f6b1b530fdb774f6e2f59c2b5bb2a279e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= Date: Tue, 4 Mar 2014 10:50:13 +0100 Subject: [PATCH] Cleaner module initialisation. --- Modules/ldapmodule.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Modules/ldapmodule.c b/Modules/ldapmodule.c index 06ac756..f920c7d 100644 --- a/Modules/ldapmodule.c +++ b/Modules/ldapmodule.c @@ -26,12 +26,8 @@ static PyMethodDef methods[] = { /* module initialisation */ -PyMODINIT_FUNC -#if PY_MAJOR_VERSION >= 3 -PyInit__ldap() -#else -init_ldap() -#endif +/* Common initialization code */ +PyObject* init_ldap_module() { PyObject *m, *d; @@ -71,3 +67,14 @@ init_ldap() return m; } + + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_ldap() { + init_ldap_module(); +} +#else +PyMODINIT_FUNC PyInit__ldap() { + return init_ldap_module(); +} +#endif