Skip to content

Commit

Permalink
Modules: Wrap macros in constants.c in do {...} while (0)
Browse files Browse the repository at this point in the history
  • Loading branch information
Petr Viktorin committed Nov 27, 2017
1 parent a367596 commit 5cbbc49
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Modules/constants.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,21 @@ LDAPinit_constants( PyObject* m )

/* Generated constants -- see Lib/ldap/constants.py */

#define add_err(n) { \
#define add_err(n) do { \
exc = PyErr_NewException("ldap." #n, LDAPexception_class, NULL); \
if (exc == NULL) return -1; \
errobjects[LDAP_##n+LDAP_ERROR_OFFSET] = exc; \
if (PyModule_AddObject(m, #n, exc) != 0) return -1; \
Py_INCREF(exc); \
}
} while (0)

#define add_int(n) { \
#define add_int(n) do { \
if (PyModule_AddIntConstant(m, #n, LDAP_##n) != 0) return -1; \
}
} while (0)

#define add_string(n) { \
#define add_string(n) do { \
if (PyModule_AddStringConstant(m, #n, LDAP_##n) != 0) return -1; \
}
} while (0)

#include "constants_generated.h"

Expand Down

0 comments on commit 5cbbc49

Please sign in to comment.