]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.1.0770: inconsistent use of ELAPSED_FUNC v8.1.0770
authorBram Moolenaar <Bram@vim.org>
Thu, 17 Jan 2019 21:28:22 +0000 (22:28 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 17 Jan 2019 21:28:22 +0000 (22:28 +0100)
Problem:    Inconsistent use of ELAPSED_FUNC.
Solution:   Consistently use ELAPSED_FUNC.  Also turn ELAPSED_TYPE into a
            typedef. (Ozaki Kiichi, closes #3815)

src/channel.c
src/gui.c
src/misc1.c
src/os_unix.c
src/version.c
src/vim.h

index e08081dd71190be5081d8ce4baac01b79b48903f..8f0577f9b62ec6d36155a3ee5a1b81936ff5d959 100644 (file)
@@ -4290,7 +4290,7 @@ channel_parse_messages(void)
     int                r;
     ch_part_T  part = PART_SOCK;
 #ifdef ELAPSED_FUNC
-    ELAPSED_TYPE  start_tv;
+    elapsed_T  start_tv;
 
     ELAPSED_INIT(start_tv);
 #endif
index cf1cee67ff8477488b1443e6eafbdd6a6b0fea70..8677787622c27a5d5c52689625cf378636cfb2a2 100644 (file)
--- a/src/gui.c
+++ b/src/gui.c
@@ -2951,9 +2951,9 @@ gui_wait_for_chars_or_timer(long wtime)
     int
 gui_wait_for_chars(long wtime, int tb_change_cnt)
 {
-    int            retval;
+    int                retval;
 #if defined(ELAPSED_FUNC)
-    ELAPSED_TYPE start_tv;
+    elapsed_T  start_tv;
 #endif
 
 #ifdef FEAT_MENU
@@ -3002,7 +3002,7 @@ gui_wait_for_chars(long wtime, int tb_change_cnt)
     if (gui_wait_for_chars_or_timer(p_ut) == OK)
        retval = OK;
     else if (trigger_cursorhold()
-#ifdef ELAPSED_FUNC
+#if defined(ELAPSED_FUNC)
            && ELAPSED_FUNC(start_tv) >= p_ut
 #endif
            && typebuf.tb_change_cnt == tb_change_cnt)
index 0a6dc87212e90be00aa7d2ea0bdde59af5688095..a4b56286aaacbafd487e2766656be0a88736df10 100644 (file)
@@ -3891,7 +3891,7 @@ vim_beep(
        {
 #ifdef ELAPSED_FUNC
            static int          did_init = FALSE;
-           static ELAPSED_TYPE start_tv;
+           static elapsed_T    start_tv;
 
            /* Only beep once per half a second, otherwise a sequence of beeps
             * would freeze Vim. */
index 04823a1e35ba25756607a47943c521bd0360a5dc..b8a92d930490aa02a05417bfaa584594a57f3611 100644 (file)
@@ -374,7 +374,7 @@ mch_inchar(
     long       wait_time;
     long       elapsed_time = 0;
 #ifdef ELAPSED_FUNC
-    ELAPSED_TYPE start_tv;
+    elapsed_T  start_tv;
 
     ELAPSED_INIT(start_tv);
 #endif
@@ -480,7 +480,7 @@ mch_inchar(
        }
 
        /* no character available */
-#if !(defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H))
+#ifndef ELAPSED_FUNC
        /* estimate the elapsed time */
        elapsed_time += wait_time;
 #endif
@@ -1907,11 +1907,11 @@ get_x11_windis(void)
 #ifdef SET_SIG_ALARM
        RETSIGTYPE (*sig_save)();
 #endif
-#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
-       struct timeval  start_tv;
+#ifdef ELAPSED_FUNC
+       elapsed_T start_tv;
 
        if (p_verbose > 0)
-           gettimeofday(&start_tv, NULL);
+           ELAPSED_INIT(start_tv);
 #endif
 
 #ifdef SET_SIG_ALARM
@@ -4831,8 +4831,8 @@ mch_call_shell_fork(
                int         fromshell_fd;
                garray_T    ga;
                int         noread_cnt;
-# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
-               struct timeval  start_tv;
+# ifdef ELAPSED_FUNC
+               elapsed_T   start_tv;
 # endif
 
 # ifdef FEAT_GUI
@@ -6073,8 +6073,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
 # 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;
+    long       start_msec = msec;
+    elapsed_T  start_tv;
 
     if (msec > 0)
        ELAPSED_INIT(start_tv);
@@ -7494,7 +7494,7 @@ setup_term_clip(void)
        int (*oldIOhandler)();
 #endif
 # ifdef ELAPSED_FUNC
-       ELAPSED_TYPE  start_tv;
+       elapsed_T start_tv;
 
        if (p_verbose > 0)
            ELAPSED_INIT(start_tv);
index b98c7e663bc70ace803417679271ecaac4ac9715..217d13d468d8b9736f18e802a7d91129826c6d96 100644 (file)
@@ -791,6 +791,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    770,
 /**/
     769,
 /**/
index b11f1ccb97e7f2547068a2885203569cf53c4d82..9ae3b30818f2b13e73747cb631ad3a74833c9960 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -2625,17 +2625,15 @@ typedef enum {
 # 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
+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