comparison src/if_python.c @ 13561:417a01a1aaaa v8.0.1654

patch 8.0.1654: warnings for conversion of void to function pointer commit https://github.com/vim/vim/commit/7b24ce08fe99345cac035215fca29c7e174a6456 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Mar 29 18:15:26 2018 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Thu, 29 Mar 2018 18:30:07 +0200
parents 8412df1479a3
children 76a65058766f
comparison
equal deleted inserted replaced
13560:197a3a32eff0 13561:417a01a1aaaa
670 */ 670 */
671 static int 671 static int
672 python_runtime_link_init(char *libname, int verbose) 672 python_runtime_link_init(char *libname, int verbose)
673 { 673 {
674 int i; 674 int i;
675 void *ucs_as_encoded_string; 675 PYTHON_PROC *ucs_as_encoded_string =
676 (PYTHON_PROC*)&py_PyUnicode_AsEncodedString;
676 677
677 #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3) 678 #if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3)
678 /* Can't have Python and Python3 loaded at the same time. 679 /* Can't have Python and Python3 loaded at the same time.
679 * It cause a crash, because RTLD_GLOBAL is needed for 680 * It cause a crash, because RTLD_GLOBAL is needed for
680 * standard C extension libraries of one or both python versions. */ 681 * standard C extension libraries of one or both python versions. */
709 } 710 }
710 } 711 }
711 712
712 /* Load unicode functions separately as only the ucs2 or the ucs4 functions 713 /* Load unicode functions separately as only the ucs2 or the ucs4 functions
713 * will be present in the library. */ 714 * will be present in the library. */
714 ucs_as_encoded_string = symbol_from_dll(hinstPython, 715 *ucs_as_encoded_string = symbol_from_dll(hinstPython,
715 "PyUnicodeUCS2_AsEncodedString"); 716 "PyUnicodeUCS2_AsEncodedString");
716 if (ucs_as_encoded_string == NULL) 717 if (*ucs_as_encoded_string == NULL)
717 ucs_as_encoded_string = symbol_from_dll(hinstPython, 718 *ucs_as_encoded_string = symbol_from_dll(hinstPython,
718 "PyUnicodeUCS4_AsEncodedString"); 719 "PyUnicodeUCS4_AsEncodedString");
719 if (ucs_as_encoded_string != NULL) 720 if (*ucs_as_encoded_string == NULL)
720 py_PyUnicode_AsEncodedString = ucs_as_encoded_string;
721 else
722 { 721 {
723 close_dll(hinstPython); 722 close_dll(hinstPython);
724 hinstPython = 0; 723 hinstPython = 0;
725 if (verbose) 724 if (verbose)
726 EMSG2(_(e_loadfunc), "PyUnicode_UCSX_*"); 725 EMSG2(_(e_loadfunc), "PyUnicode_UCSX_*");