Problem: Inconsistent use of ELAPSED_FUNC.
Solution: Consistently use ELAPSED_FUNC. Also turn ELAPSED_TYPE into a
typedef. (Ozaki Kiichi, closes #3815)
int r;
ch_part_T part = PART_SOCK;
#ifdef ELAPSED_FUNC
- ELAPSED_TYPE start_tv;
+ elapsed_T start_tv;
ELAPSED_INIT(start_tv);
#endif
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
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)
{
#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. */
long wait_time;
long elapsed_time = 0;
#ifdef ELAPSED_FUNC
- ELAPSED_TYPE start_tv;
+ elapsed_T start_tv;
ELAPSED_INIT(start_tv);
#endif
}
/* no character available */
-#if !(defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H))
+#ifndef ELAPSED_FUNC
/* estimate the elapsed time */
elapsed_time += wait_time;
#endif
#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
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
# 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);
int (*oldIOhandler)();
#endif
# ifdef ELAPSED_FUNC
- ELAPSED_TYPE start_tv;
+ elapsed_T start_tv;
if (p_verbose > 0)
ELAPSED_INIT(start_tv);
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 770,
/**/
769,
/**/
# 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