To: vim_dev@googlegroups.com Subject: Patch 8.1.0770 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.0770 Problem: Inconsistent use of ELAPSED_FUNC. Solution: Consistently use ELAPSED_FUNC. Also turn ELAPSED_TYPE into a typedef. (Ozaki Kiichi, closes #3815) Files: src/channel.c, src/gui.c, src/misc1.c, src/os_unix.c, src/vim.h *** ../vim-8.1.0769/src/channel.c 2019-01-17 14:31:10.190919265 +0100 --- src/channel.c 2019-01-17 22:20:19.225226754 +0100 *************** *** 4290,4296 **** int r; ch_part_T part = PART_SOCK; #ifdef ELAPSED_FUNC ! ELAPSED_TYPE start_tv; ELAPSED_INIT(start_tv); #endif --- 4290,4296 ---- int r; ch_part_T part = PART_SOCK; #ifdef ELAPSED_FUNC ! elapsed_T start_tv; ELAPSED_INIT(start_tv); #endif *** ../vim-8.1.0769/src/gui.c 2019-01-17 15:43:21.761878368 +0100 --- src/gui.c 2019-01-17 22:20:19.225226754 +0100 *************** *** 2951,2959 **** int gui_wait_for_chars(long wtime, int tb_change_cnt) { ! int retval; #if defined(ELAPSED_FUNC) ! ELAPSED_TYPE start_tv; #endif #ifdef FEAT_MENU --- 2951,2959 ---- int gui_wait_for_chars(long wtime, int tb_change_cnt) { ! int retval; #if defined(ELAPSED_FUNC) ! elapsed_T start_tv; #endif #ifdef FEAT_MENU *************** *** 3002,3008 **** if (gui_wait_for_chars_or_timer(p_ut) == OK) retval = OK; else if (trigger_cursorhold() ! #ifdef ELAPSED_FUNC && ELAPSED_FUNC(start_tv) >= p_ut #endif && typebuf.tb_change_cnt == tb_change_cnt) --- 3002,3008 ---- if (gui_wait_for_chars_or_timer(p_ut) == OK) retval = OK; else if (trigger_cursorhold() ! #if defined(ELAPSED_FUNC) && ELAPSED_FUNC(start_tv) >= p_ut #endif && typebuf.tb_change_cnt == tb_change_cnt) *** ../vim-8.1.0769/src/misc1.c 2019-01-13 23:38:33.399773248 +0100 --- src/misc1.c 2019-01-17 22:20:19.229226723 +0100 *************** *** 3891,3897 **** { #ifdef ELAPSED_FUNC static int did_init = FALSE; ! static ELAPSED_TYPE start_tv; /* Only beep once per half a second, otherwise a sequence of beeps * would freeze Vim. */ --- 3891,3897 ---- { #ifdef ELAPSED_FUNC static int did_init = FALSE; ! static elapsed_T start_tv; /* Only beep once per half a second, otherwise a sequence of beeps * would freeze Vim. */ *** ../vim-8.1.0769/src/os_unix.c 2019-01-13 23:38:33.407773189 +0100 --- src/os_unix.c 2019-01-17 22:20:19.229226723 +0100 *************** *** 374,380 **** long wait_time; long elapsed_time = 0; #ifdef ELAPSED_FUNC ! ELAPSED_TYPE start_tv; ELAPSED_INIT(start_tv); #endif --- 374,380 ---- long wait_time; long elapsed_time = 0; #ifdef ELAPSED_FUNC ! elapsed_T start_tv; ELAPSED_INIT(start_tv); #endif *************** *** 480,486 **** } /* no character available */ ! #if !(defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)) /* estimate the elapsed time */ elapsed_time += wait_time; #endif --- 480,486 ---- } /* no character available */ ! #ifndef ELAPSED_FUNC /* estimate the elapsed time */ elapsed_time += wait_time; #endif *************** *** 1907,1917 **** #ifdef SET_SIG_ALARM RETSIGTYPE (*sig_save)(); #endif ! #if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) ! struct timeval start_tv; if (p_verbose > 0) ! gettimeofday(&start_tv, NULL); #endif #ifdef SET_SIG_ALARM --- 1907,1917 ---- #ifdef SET_SIG_ALARM RETSIGTYPE (*sig_save)(); #endif ! #ifdef ELAPSED_FUNC ! elapsed_T start_tv; if (p_verbose > 0) ! ELAPSED_INIT(start_tv); #endif #ifdef SET_SIG_ALARM *************** *** 4831,4838 **** int fromshell_fd; garray_T ga; int noread_cnt; ! # if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) ! struct timeval start_tv; # endif # ifdef FEAT_GUI --- 4831,4838 ---- int fromshell_fd; garray_T ga; int noread_cnt; ! # ifdef ELAPSED_FUNC ! elapsed_T start_tv; # endif # ifdef FEAT_GUI *************** *** 6073,6080 **** # ifdef ELAPSED_FUNC /* Remember at what time we started, so that we know how much longer we * should wait after being interrupted. */ ! long start_msec = msec; ! ELAPSED_TYPE start_tv; if (msec > 0) ELAPSED_INIT(start_tv); --- 6073,6080 ---- # ifdef ELAPSED_FUNC /* Remember at what time we started, so that we know how much longer we * should wait after being interrupted. */ ! long start_msec = msec; ! elapsed_T start_tv; if (msec > 0) ELAPSED_INIT(start_tv); *************** *** 7494,7500 **** int (*oldIOhandler)(); #endif # ifdef ELAPSED_FUNC ! ELAPSED_TYPE start_tv; if (p_verbose > 0) ELAPSED_INIT(start_tv); --- 7494,7500 ---- int (*oldIOhandler)(); #endif # ifdef ELAPSED_FUNC ! elapsed_T start_tv; if (p_verbose > 0) ELAPSED_INIT(start_tv); *** ../vim-8.1.0769/src/vim.h 2019-01-17 17:13:25.924984061 +0100 --- src/vim.h 2019-01-17 22:20:19.229226723 +0100 *************** *** 2625,2641 **** # define ELAPSED_TIMEVAL # define ELAPSED_INIT(v) gettimeofday(&v, NULL) # define ELAPSED_FUNC(v) elapsed(&v) ! # define ELAPSED_TYPE struct timeval ! long elapsed(struct timeval *start_tv); ! #else ! # if defined(WIN32) ! # define ELAPSED_TICKCOUNT ! # define ELAPSED_INIT(v) v = GetTickCount() ! # define ELAPSED_FUNC(v) elapsed(v) ! # define ELAPSED_TYPE DWORD ! # ifndef PROTO ! long elapsed(DWORD start_tick); ! # endif # endif #endif --- 2625,2639 ---- # define ELAPSED_TIMEVAL # define ELAPSED_INIT(v) gettimeofday(&v, NULL) # define ELAPSED_FUNC(v) elapsed(&v) ! typedef struct timeval elapsed_T; ! long elapsed(struct timeval *start_tv); ! #elif defined(WIN32) ! # define ELAPSED_TICKCOUNT ! # define ELAPSED_INIT(v) v = GetTickCount() ! # define ELAPSED_FUNC(v) elapsed(v) ! typedef DWORD elapsed_T; ! # ifndef PROTO ! long elapsed(DWORD start_tick); # endif #endif *** ../vim-8.1.0769/src/version.c 2019-01-17 22:13:50.588531539 +0100 --- src/version.c 2019-01-17 22:20:47.004998591 +0100 *************** *** 793,794 **** --- 793,796 ---- { /* Add new patch number below this line */ + /**/ + 770, /**/ -- Eagles may soar, but weasels don't get sucked into jet engines. /// 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 ///