summaryrefslogtreecommitdiffstats
path: root/src/if_python.c
diff options
context:
space:
mode:
authorKen Takata <kentkt@csc.jp>2023-10-11 21:27:06 +0200
committerChristian Brabandt <cb@256bit.org>2023-10-11 21:27:06 +0200
commitc97b3febc82c1ccacf5f328ed0bd81c8b850e97d (patch)
tree8ab62fd87ed25bcfdc8c5394a7b104876f7f948a /src/if_python.c
parenta634b92b969e1bcb47551a39bf4e11e41ba9aa17 (diff)
patch 9.0.2013: confusing ifdefs in if_<lang>.cv9.0.2014
Problem: confusing ifdefs in if_<lang>.c Solution: refactor ifndefs to #ifdefs if_x: Avoid using #ifndef - #else - #endif Using #ifndef - #else - #endif is sometimes confusing. Use #ifdef - #else - #endif instead. closes: #13310 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Ken Takata <kentkt@csc.jp>
Diffstat (limited to 'src/if_python.c')
-rw-r--r--src/if_python.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/if_python.c b/src/if_python.c
index af5d6c0a81..461ba52cf2 100644
--- a/src/if_python.c
+++ b/src/if_python.c
@@ -130,7 +130,12 @@ struct PyMethodDef { Py_ssize_t a; };
# define HINSTANCE long_u // for generating prototypes
# endif
-# ifndef MSWIN
+# ifdef MSWIN
+# define load_dll vimLoadLib
+# define close_dll FreeLibrary
+# define symbol_from_dll GetProcAddress
+# define load_dll_error GetWin32Error
+# else
# include <dlfcn.h>
# define FARPROC void*
# define HINSTANCE void*
@@ -142,11 +147,6 @@ struct PyMethodDef { Py_ssize_t a; };
# define close_dll dlclose
# define symbol_from_dll dlsym
# define load_dll_error dlerror
-# else
-# define load_dll vimLoadLib
-# define close_dll FreeLibrary
-# define symbol_from_dll GetProcAddress
-# define load_dll_error GetWin32Error
# endif
// This makes if_python.c compile without warnings against Python 2.5
@@ -496,14 +496,14 @@ static struct
PYTHON_PROC *ptr;
} python_funcname_table[] =
{
-# ifndef PY_SSIZE_T_CLEAN
- {"PyArg_Parse", (PYTHON_PROC*)&dll_PyArg_Parse},
- {"PyArg_ParseTuple", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
- {"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue},
-# else
+# ifdef PY_SSIZE_T_CLEAN
{"_PyArg_Parse_SizeT", (PYTHON_PROC*)&dll_PyArg_Parse},
{"_PyArg_ParseTuple_SizeT", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
{"_Py_BuildValue_SizeT", (PYTHON_PROC*)&dll_Py_BuildValue},
+# else
+ {"PyArg_Parse", (PYTHON_PROC*)&dll_PyArg_Parse},
+ {"PyArg_ParseTuple", (PYTHON_PROC*)&dll_PyArg_ParseTuple},
+ {"Py_BuildValue", (PYTHON_PROC*)&dll_Py_BuildValue},
# endif
{"PyMem_Free", (PYTHON_PROC*)&dll_PyMem_Free},
{"PyMem_Malloc", (PYTHON_PROC*)&dll_PyMem_Malloc},