Skip to content

Commit 75a765f

Browse files
committed
refactor: Merge all header files
Merge all header files except `constants_generated.h` into a single header file `pythonldap.h`. A single header file makes it far easier to port python-ldap to heap types and module state for Per-Interpreter GIL. `pythonldap.h` uses new macros `PYLDAP_FUNC` and `PYLDAP_DATA` to declare functions and data, which are used across C files. Remove unused macro `streq`. See: #540 Signed-off-by: Christian Heimes <[email protected]>
1 parent 1490e99 commit 75a765f

20 files changed

+149
-231
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ valgrind: build $(PYTHON_SUPP)
8989
autoformat: indent black
9090

9191
indent:
92-
indent Modules/*.c Modules/*.h
92+
indent Modules/*.c
93+
indent -npsl Modules/pythonldap.h
9394
rm -f Modules/*.c~ Modules/*.h~
9495

9596
black:

Modules/LDAPObject.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
/* See https://www.python-ldap.org/ for details. */
22

3-
#include "common.h"
3+
#include "pythonldap.h"
44
#include "patchlevel.h"
55

66
#include <math.h>
77
#include <limits.h>
8-
#include "constants.h"
9-
#include "LDAPObject.h"
10-
#include "ldapcontrol.h"
11-
#include "message.h"
12-
#include "berval.h"
13-
#include "options.h"
148

159
#ifdef HAVE_SASL
1610
#include <sasl/sasl.h>

Modules/LDAPObject.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

Modules/berval.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* See https://www.python-ldap.org/ for details. */
22

3-
#include "common.h"
4-
#include "berval.h"
3+
#include "pythonldap.h"
54

65
/*
76
* Copies out the data from a berval, and returns it as a new Python object,

Modules/berval.h

Lines changed: 0 additions & 11 deletions
This file was deleted.

Modules/common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* Miscellaneous common routines
22
* See https://www.python-ldap.org/ for details. */
33

4-
#include "common.h"
4+
#include "pythonldap.h"
55

66
/* dynamically add the methods into the module dictionary d */
77

Modules/common.h

Lines changed: 0 additions & 68 deletions
This file was deleted.

Modules/constants.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/* constants defined for LDAP
22
* See https://www.python-ldap.org/ for details. */
33

4-
#include "common.h"
5-
#include "constants.h"
6-
#include "ldapcontrol.h"
4+
#include "pythonldap.h"
75

86
/* the base exception class */
97

Modules/constants.h

Lines changed: 0 additions & 24 deletions
This file was deleted.

Modules/functions.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
/* See https://www.python-ldap.org/ for details. */
22

3-
#include "common.h"
4-
#include "functions.h"
5-
#include "LDAPObject.h"
6-
#include "berval.h"
7-
#include "constants.h"
8-
#include "options.h"
3+
#include "pythonldap.h"
94

105
/* ldap_initialize */
116

Modules/functions.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

Modules/ldapcontrol.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
/* See https://www.python-ldap.org/ for details. */
22

3-
#include "common.h"
4-
#include "LDAPObject.h"
5-
#include "ldapcontrol.h"
6-
#include "berval.h"
7-
#include "constants.h"
3+
#include "pythonldap.h"
84

95
/* Prints to stdout the contents of an array of LDAPControl objects */
106

Modules/ldapcontrol.h

Lines changed: 0 additions & 13 deletions
This file was deleted.

Modules/ldapmodule.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
/* See https://www.python-ldap.org/ for details. */
22

3-
#include "common.h"
4-
#include "constants.h"
5-
#include "functions.h"
6-
#include "ldapcontrol.h"
7-
8-
#include "LDAPObject.h"
3+
#include "pythonldap.h"
94

105
#if PY_MAJOR_VERSION >= 3
116
PyMODINIT_FUNC PyInit__ldap(void);

Modules/message.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
/* See https://www.python-ldap.org/ for details. */
22

3-
#include "common.h"
4-
#include "message.h"
5-
#include "berval.h"
6-
#include "ldapcontrol.h"
7-
#include "constants.h"
3+
#include "pythonldap.h"
84

95
/*
106
* Converts an LDAP message into a Python structure.

Modules/message.h

Lines changed: 0 additions & 11 deletions
This file was deleted.

Modules/options.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
/* See https://www.python-ldap.org/ for details. */
22

3-
#include "common.h"
4-
#include "constants.h"
5-
#include "LDAPObject.h"
6-
#include "ldapcontrol.h"
7-
#include "options.h"
8-
#include "berval.h"
3+
#include "pythonldap.h"
94

105
void
116
set_timeval_from_double(struct timeval *tv, double d)

Modules/options.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)