0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 8.0.1654: warnings for conversion of void to function pointer

Problem:    Warnings for conversion of void to function pointer.
Solution:   Use a temp variable that is a function pointer.
This commit is contained in:
Bram Moolenaar
2018-03-29 18:15:26 +02:00
parent 1834d37396
commit 7b24ce08fe
3 changed files with 25 additions and 25 deletions

View File

@@ -672,7 +672,8 @@ end_dynamic_python(void)
python_runtime_link_init(char *libname, int verbose) python_runtime_link_init(char *libname, int verbose)
{ {
int i; int i;
void *ucs_as_encoded_string; PYTHON_PROC *ucs_as_encoded_string =
(PYTHON_PROC*)&py_PyUnicode_AsEncodedString;
#if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3) #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3)
/* Can't have Python and Python3 loaded at the same time. /* Can't have Python and Python3 loaded at the same time.
@@ -711,14 +712,12 @@ python_runtime_link_init(char *libname, int verbose)
/* Load unicode functions separately as only the ucs2 or the ucs4 functions /* Load unicode functions separately as only the ucs2 or the ucs4 functions
* will be present in the library. */ * will be present in the library. */
ucs_as_encoded_string = symbol_from_dll(hinstPython, *ucs_as_encoded_string = symbol_from_dll(hinstPython,
"PyUnicodeUCS2_AsEncodedString"); "PyUnicodeUCS2_AsEncodedString");
if (ucs_as_encoded_string == NULL) if (*ucs_as_encoded_string == NULL)
ucs_as_encoded_string = symbol_from_dll(hinstPython, *ucs_as_encoded_string = symbol_from_dll(hinstPython,
"PyUnicodeUCS4_AsEncodedString"); "PyUnicodeUCS4_AsEncodedString");
if (ucs_as_encoded_string != NULL) if (*ucs_as_encoded_string == NULL)
py_PyUnicode_AsEncodedString = ucs_as_encoded_string;
else
{ {
close_dll(hinstPython); close_dll(hinstPython);
hinstPython = 0; hinstPython = 0;

View File

@@ -600,7 +600,10 @@ end_dynamic_python3(void)
py3_runtime_link_init(char *libname, int verbose) py3_runtime_link_init(char *libname, int verbose)
{ {
int i; 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) # 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. /* 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 /* Load unicode functions separately as only the ucs2 or the ucs4 functions
* will be present in the library. */ * will be present in the library. */
# if PY_VERSION_HEX >= 0x030300f0 # if PY_VERSION_HEX >= 0x030300f0
ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString"); *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicode_FromString");
ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode"); *ucs_decode = symbol_from_dll(hinstPy3, "PyUnicode_Decode");
ucs_as_encoded_string = symbol_from_dll(hinstPy3, *ucs_as_encoded_string = symbol_from_dll(hinstPy3,
"PyUnicode_AsEncodedString"); "PyUnicode_AsEncodedString");
# else # else
ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString"); *ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString");
ucs_decode = symbol_from_dll(hinstPy3, *ucs_decode = symbol_from_dll(hinstPy3,
"PyUnicodeUCS2_Decode"); "PyUnicodeUCS2_Decode");
ucs_as_encoded_string = symbol_from_dll(hinstPy3, *ucs_as_encoded_string = symbol_from_dll(hinstPy3,
"PyUnicodeUCS2_AsEncodedString"); "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"); "PyUnicodeUCS4_FromString");
ucs_decode = symbol_from_dll(hinstPy3, *ucs_decode = symbol_from_dll(hinstPy3,
"PyUnicodeUCS4_Decode"); "PyUnicodeUCS4_Decode");
ucs_as_encoded_string = symbol_from_dll(hinstPy3, *ucs_as_encoded_string = symbol_from_dll(hinstPy3,
"PyUnicodeUCS4_AsEncodedString"); "PyUnicodeUCS4_AsEncodedString");
} }
# endif # endif
if (ucs_from_string && ucs_decode && ucs_as_encoded_string) if (*ucs_from_string == NULL || *ucs_decode == NULL
{ || *ucs_as_encoded_string == NULL)
py3_PyUnicode_FromString = ucs_from_string;
py3_PyUnicode_Decode = ucs_decode;
py3_PyUnicode_AsEncodedString = ucs_as_encoded_string;
}
else
{ {
close_dll(hinstPy3); close_dll(hinstPy3);
hinstPy3 = 0; hinstPy3 = 0;

View File

@@ -762,6 +762,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1654,
/**/ /**/
1653, 1653,
/**/ /**/