summaryrefslogtreecommitdiff
path: root/src/if_python3.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-03-29 18:15:26 +0200
committerBram Moolenaar <Bram@vim.org>2018-03-29 18:15:26 +0200
commit7b24ce08fe99345cac035215fca29c7e174a6456 (patch)
tree9e4b16243f3c4eb9906a6e35950b8f14c994999a /src/if_python3.c
parent1834d37396e046ccbc4aa2678ba16a38197da6b4 (diff)
downloadvim-git-7b24ce08fe99345cac035215fca29c7e174a6456.tar.gz
patch 8.0.1654: warnings for conversion of void to function pointerv8.0.1654
Problem: Warnings for conversion of void to function pointer. Solution: Use a temp variable that is a function pointer.
Diffstat (limited to 'src/if_python3.c')
-rw-r--r--src/if_python3.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/src/if_python3.c b/src/if_python3.c
index 59c115dd8..b885deb04 100644
--- a/src/if_python3.c
+++ b/src/if_python3.c
@@ -600,7 +600,10 @@ end_dynamic_python3(void)
py3_runtime_link_init(char *libname, int verbose)
{
int i;
- void *ucs_from_string, *ucs_decode, *ucs_as_encoded_string;
+ PYTHON_PROC *ucs_from_string = (PYTHON_PROC *)&py3_PyUnicode_FromString;
+ PYTHON_PROC *ucs_decode = (PYTHON_PROC *)&py3_PyUnicode_Decode;
+ PYTHON_PROC *ucs_as_encoded_string =
+ (PYTHON_PROC *)&py3_PyUnicode_AsEncodedString;
# if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON)
/* Can't have Python and Python3 loaded at the same time.
@@ -641,33 +644,29 @@ py3_runtime_link_init(char *libname, int verbose)
/* Load unicode functions separately as only the ucs2 or the ucs4 functions
* will be present in the library. */
# if PY_VERSION_HEX >= 0x030300f0
- ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString");
- ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode");
- ucs_as_encoded_string = symbol_from_dll(hinstPy3,
+ *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString");
+ *ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode");
+ *ucs_as_encoded_string = symbol_from_dll(hinstPy3,
"PyUnicode_AsEncodedString");
# else
- ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString");
- ucs_decode = symbol_from_dll(hinstPy3,
+ *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString");
+ *ucs_decode = symbol_from_dll(hinstPy3,
"PyUnicodeUCS2_Decode");
- ucs_as_encoded_string = symbol_from_dll(hinstPy3,
+ *ucs_as_encoded_string = symbol_from_dll(hinstPy3,
"PyUnicodeUCS2_AsEncodedString");
- if (!ucs_from_string || !ucs_decode || !ucs_as_encoded_string)
+ if (*ucs_from_string == NULL || *ucs_decode == NULL
+ || *ucs_as_encoded_string == NULL)
{
- ucs_from_string = symbol_from_dll(hinstPy3,
+ *ucs_from_string = symbol_from_dll(hinstPy3,
"PyUnicodeUCS4_FromString");
- ucs_decode = symbol_from_dll(hinstPy3,
+ *ucs_decode = symbol_from_dll(hinstPy3,
"PyUnicodeUCS4_Decode");
- ucs_as_encoded_string = symbol_from_dll(hinstPy3,
+ *ucs_as_encoded_string = symbol_from_dll(hinstPy3,
"PyUnicodeUCS4_AsEncodedString");
}
# endif
- if (ucs_from_string && ucs_decode && ucs_as_encoded_string)
- {
- py3_PyUnicode_FromString = ucs_from_string;
- py3_PyUnicode_Decode = ucs_decode;
- py3_PyUnicode_AsEncodedString = ucs_as_encoded_string;
- }
- else
+ if (*ucs_from_string == NULL || *ucs_decode == NULL
+ || *ucs_as_encoded_string == NULL)
{
close_dll(hinstPy3);
hinstPy3 = 0;