To: vim_dev@googlegroups.com Subject: Patch 7.4.1216 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.1216 Problem: Still using HAVE_STDARG_H. Solution: Assume it's always defined. Files: src/eval.c, src/misc2.c, src/vim.h, src/proto.h, src/congifure.in, src/auto/configure, config.h.in, src/os_amiga.h, src/os_msdos.h, src/os_vms_conf.h, src/os_win32.h *** ../vim-7.4.1215/src/eval.c 2016-01-30 15:14:02.547448831 +0100 --- src/eval.c 2016-01-30 21:32:37.687199370 +0100 *************** *** 15217,15229 **** rettv->vval.v_number = lnum; } - #ifdef HAVE_STDARG_H /* This dummy va_list is here because: * - passing a NULL pointer doesn't work when va_list isn't a pointer * - locally in the function results in a "used before set" warning * - using va_start() to initialize it gives "function with fixed args" error */ static va_list ap; - #endif /* * "printf()" function --- 15217,15227 ---- *************** *** 15231,15262 **** static void f_printf(typval_T *argvars, typval_T *rettv) { rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - #ifdef HAVE_STDARG_H /* only very old compilers can't do this */ - { - char_u buf[NUMBUFLEN]; - int len; - char_u *s; - int saved_did_emsg = did_emsg; - char *fmt; ! /* Get the required length, allocate the buffer and do it for real. */ ! did_emsg = FALSE; ! fmt = (char *)get_tv_string_buf(&argvars[0], buf); ! len = vim_vsnprintf(NULL, 0, fmt, ap, argvars + 1); ! if (!did_emsg) { ! s = alloc(len + 1); ! if (s != NULL) ! { ! rettv->vval.v_string = s; ! (void)vim_vsnprintf((char *)s, len + 1, fmt, ap, argvars + 1); ! } } - did_emsg |= saved_did_emsg; } ! #endif } /* --- 15229,15257 ---- static void f_printf(typval_T *argvars, typval_T *rettv) { + char_u buf[NUMBUFLEN]; + int len; + char_u *s; + int saved_did_emsg = did_emsg; + char *fmt; + rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; ! /* Get the required length, allocate the buffer and do it for real. */ ! did_emsg = FALSE; ! fmt = (char *)get_tv_string_buf(&argvars[0], buf); ! len = vim_vsnprintf(NULL, 0, fmt, ap, argvars + 1); ! if (!did_emsg) ! { ! s = alloc(len + 1); ! if (s != NULL) { ! rettv->vval.v_string = s; ! (void)vim_vsnprintf((char *)s, len + 1, fmt, ap, argvars + 1); } } ! did_emsg |= saved_did_emsg; } /* *** ../vim-7.4.1215/src/misc2.c 2016-01-30 19:39:45.277838615 +0100 --- src/misc2.c 2016-01-30 21:33:04.154922786 +0100 *************** *** 6023,6033 **** { if (emsg_not_now()) return TRUE; /* no error messages at the moment */ - #ifdef HAVE_STDARG_H vim_snprintf((char *)IObuff, IOSIZE, (char *)s, a1, a2); - #else - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, (long_u)a1, (long_u)a2); - #endif return emsg(IObuff); } --- 6023,6029 ---- *** ../vim-7.4.1215/src/vim.h 2016-01-30 13:28:23.925007165 +0100 --- src/vim.h 2016-01-30 21:34:51.729798697 +0100 *************** *** 508,516 **** #ifdef HAVE_WCTYPE_H # include #endif ! #ifdef HAVE_STDARG_H ! # include ! #endif #if defined(HAVE_SYS_SELECT_H) && \ (!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME)) --- 508,514 ---- #ifdef HAVE_WCTYPE_H # include #endif ! #include #if defined(HAVE_SYS_SELECT_H) && \ (!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME)) *** ../vim-7.4.1215/src/proto.h 2016-01-29 23:20:35.313308119 +0100 --- src/proto.h 2016-01-30 21:34:42.369896499 +0100 *************** *** 104,112 **** # include "menu.pro" # endif ! # if !defined MESSAGE_FILE || defined(HAVE_STDARG_H) ! /* These prototypes cannot be produced automatically and conflict with ! * the old-style prototypes in message.c. */ int # ifdef __BORLANDC__ _RTLENTRYF --- 104,110 ---- # include "menu.pro" # endif ! /* These prototypes cannot be produced automatically. */ int # ifdef __BORLANDC__ _RTLENTRYF *************** *** 131,140 **** # endif vim_snprintf(char *, size_t, char *, ...); - # if defined(HAVE_STDARG_H) int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs); - # endif - # endif # include "message.pro" # include "misc1.pro" --- 129,135 ---- *** ../vim-7.4.1215/src/auto/configure 2016-01-28 15:34:21.935646156 +0100 --- src/auto/configure 2016-01-30 21:36:37.820682178 +0100 *************** *** 10064,10070 **** rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ! for ac_header in stdarg.h stdint.h stdlib.h string.h \ sys/select.h sys/utsname.h termcap.h fcntl.h \ sgtty.h sys/ioctl.h sys/time.h sys/types.h \ termio.h iconv.h inttypes.h langinfo.h math.h \ --- 10064,10070 ---- rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ! for ac_header in stdint.h stdlib.h string.h \ sys/select.h sys/utsname.h termcap.h fcntl.h \ sgtty.h sys/ioctl.h sys/time.h sys/types.h \ termio.h iconv.h inttypes.h langinfo.h math.h \ *** ../vim-7.4.1215/src/os_amiga.h 2013-06-12 20:09:44.000000000 +0200 --- src/os_amiga.h 2016-01-30 21:36:57.316476833 +0100 *************** *** 20,28 **** # if defined(AZTEC_C) || defined(__amigaos4__) # define HAVE_STAT_H # endif - # ifdef __amigaos4__ - # define HAVE_STDARG_H - # endif # define HAVE_STDLIB_H # define HAVE_STRING_H # define HAVE_FCNTL_H --- 20,25 ---- *** ../vim-7.4.1215/src/os_msdos.h 2012-11-20 15:57:48.000000000 +0100 --- src/os_msdos.h 2016-01-30 21:37:09.832345010 +0100 *************** *** 21,27 **** # define USE_LONG_FNAME _USE_LFN /* decide at run time */ # define USE_FNAME_CASE # define HAVE_PUTENV - # define HAVE_STDARG_H #else # define SHORT_FNAME /* always 8.3 file name */ #endif --- 21,26 ---- *** ../vim-7.4.1215/src/os_vms_conf.h 2014-03-12 16:51:35.060792541 +0100 --- src/os_vms_conf.h 2016-01-30 21:37:24.688188545 +0100 *************** *** 109,115 **** #define HAVE_FSYNC #define HAVE_GETPWUID #define HAVE_GETPWNAM - #define HAVE_STDARG_H #define HAVE_STDLIB_H #define HAVE_STRING_H #define HAVE_ERRNO_H --- 109,114 ---- *** ../vim-7.4.1215/src/os_win32.h 2016-01-02 21:11:47.111238151 +0100 --- src/os_win32.h 2016-01-30 21:37:40.480022227 +0100 *************** *** 49,57 **** #ifndef HAVE_FCNTL_H # define HAVE_FCNTL_H #endif - #ifndef HAVE_STDARG_H - # define HAVE_STDARG_H - #endif #define HAVE_QSORT #define HAVE_ST_MODE /* have stat.st_mode */ --- 49,54 ---- *** ../vim-7.4.1215/src/version.c 2016-01-30 21:29:52.236928421 +0100 --- src/version.c 2016-01-30 21:31:43.251768228 +0100 *************** *** 748,749 **** --- 748,751 ---- { /* Add new patch number below this line */ + /**/ + 1216, /**/ -- Where do you want to crash today? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///