common.h 794 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* common utility macros
  2. * See http://www.python-ldap.org/ for details.
  3. * $Id: common.h,v 1.8 2009/04/17 12:19:09 stroeder Exp $ */
  4. #ifndef __h_common
  5. #define __h_common
  6. #define PY_SSIZE_T_CLEAN
  7. #include "Python.h"
  8. #if defined(HAVE_CONFIG_H)
  9. #include "config.h"
  10. #endif
  11. #if defined(MS_WINDOWS)
  12. #include <winsock.h>
  13. #else /* unix */
  14. #include <netdb.h>
  15. #include <sys/time.h>
  16. #include <sys/types.h>
  17. #endif
  18. /* Backwards compability with Python prior 2.5 */
  19. #if PY_VERSION_HEX < 0x02050000
  20. typedef int Py_ssize_t;
  21. #define PY_SSIZE_T_MAX INT_MAX
  22. #define PY_SSIZE_T_MIN INT_MIN
  23. #endif
  24. #include <string.h>
  25. #define streq( a, b ) \
  26. ( (*(a)==*(b)) && 0==strcmp(a,b) )
  27. void LDAPadd_methods( PyObject*d, PyMethodDef*methods );
  28. #define PyNone_Check(o) ((o) == Py_None)
  29. #endif /* __h_common_ */