mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.1.0770: inconsistent use of ELAPSED_FUNC
Problem: Inconsistent use of ELAPSED_FUNC. Solution: Consistently use ELAPSED_FUNC. Also turn ELAPSED_TYPE into a typedef. (Ozaki Kiichi, closes #3815)
This commit is contained in:
parent
3020ccb113
commit
1ac56c2d11
@ -4290,7 +4290,7 @@ channel_parse_messages(void)
|
|||||||
int r;
|
int r;
|
||||||
ch_part_T part = PART_SOCK;
|
ch_part_T part = PART_SOCK;
|
||||||
#ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
ELAPSED_TYPE start_tv;
|
elapsed_T start_tv;
|
||||||
|
|
||||||
ELAPSED_INIT(start_tv);
|
ELAPSED_INIT(start_tv);
|
||||||
#endif
|
#endif
|
||||||
|
@ -2951,9 +2951,9 @@ gui_wait_for_chars_or_timer(long wtime)
|
|||||||
int
|
int
|
||||||
gui_wait_for_chars(long wtime, int tb_change_cnt)
|
gui_wait_for_chars(long wtime, int tb_change_cnt)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
#if defined(ELAPSED_FUNC)
|
#if defined(ELAPSED_FUNC)
|
||||||
ELAPSED_TYPE start_tv;
|
elapsed_T start_tv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_MENU
|
#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)
|
if (gui_wait_for_chars_or_timer(p_ut) == OK)
|
||||||
retval = OK;
|
retval = OK;
|
||||||
else if (trigger_cursorhold()
|
else if (trigger_cursorhold()
|
||||||
#ifdef ELAPSED_FUNC
|
#if defined(ELAPSED_FUNC)
|
||||||
&& ELAPSED_FUNC(start_tv) >= p_ut
|
&& ELAPSED_FUNC(start_tv) >= p_ut
|
||||||
#endif
|
#endif
|
||||||
&& typebuf.tb_change_cnt == tb_change_cnt)
|
&& typebuf.tb_change_cnt == tb_change_cnt)
|
||||||
|
@ -3891,7 +3891,7 @@ vim_beep(
|
|||||||
{
|
{
|
||||||
#ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
static int did_init = FALSE;
|
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
|
/* Only beep once per half a second, otherwise a sequence of beeps
|
||||||
* would freeze Vim. */
|
* would freeze Vim. */
|
||||||
|
@ -374,7 +374,7 @@ mch_inchar(
|
|||||||
long wait_time;
|
long wait_time;
|
||||||
long elapsed_time = 0;
|
long elapsed_time = 0;
|
||||||
#ifdef ELAPSED_FUNC
|
#ifdef ELAPSED_FUNC
|
||||||
ELAPSED_TYPE start_tv;
|
elapsed_T start_tv;
|
||||||
|
|
||||||
ELAPSED_INIT(start_tv);
|
ELAPSED_INIT(start_tv);
|
||||||
#endif
|
#endif
|
||||||
@ -480,7 +480,7 @@ mch_inchar(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* no character available */
|
/* no character available */
|
||||||
#if !(defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H))
|
#ifndef ELAPSED_FUNC
|
||||||
/* estimate the elapsed time */
|
/* estimate the elapsed time */
|
||||||
elapsed_time += wait_time;
|
elapsed_time += wait_time;
|
||||||
#endif
|
#endif
|
||||||
@ -1907,11 +1907,11 @@ get_x11_windis(void)
|
|||||||
#ifdef SET_SIG_ALARM
|
#ifdef SET_SIG_ALARM
|
||||||
RETSIGTYPE (*sig_save)();
|
RETSIGTYPE (*sig_save)();
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
|
#ifdef ELAPSED_FUNC
|
||||||
struct timeval start_tv;
|
elapsed_T start_tv;
|
||||||
|
|
||||||
if (p_verbose > 0)
|
if (p_verbose > 0)
|
||||||
gettimeofday(&start_tv, NULL);
|
ELAPSED_INIT(start_tv);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SET_SIG_ALARM
|
#ifdef SET_SIG_ALARM
|
||||||
@ -4831,8 +4831,8 @@ mch_call_shell_fork(
|
|||||||
int fromshell_fd;
|
int fromshell_fd;
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
int noread_cnt;
|
int noread_cnt;
|
||||||
# if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
|
# ifdef ELAPSED_FUNC
|
||||||
struct timeval start_tv;
|
elapsed_T start_tv;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef FEAT_GUI
|
# ifdef FEAT_GUI
|
||||||
@ -6073,8 +6073,8 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
|
|||||||
# ifdef ELAPSED_FUNC
|
# ifdef ELAPSED_FUNC
|
||||||
/* Remember at what time we started, so that we know how much longer we
|
/* Remember at what time we started, so that we know how much longer we
|
||||||
* should wait after being interrupted. */
|
* should wait after being interrupted. */
|
||||||
long start_msec = msec;
|
long start_msec = msec;
|
||||||
ELAPSED_TYPE start_tv;
|
elapsed_T start_tv;
|
||||||
|
|
||||||
if (msec > 0)
|
if (msec > 0)
|
||||||
ELAPSED_INIT(start_tv);
|
ELAPSED_INIT(start_tv);
|
||||||
@ -7494,7 +7494,7 @@ setup_term_clip(void)
|
|||||||
int (*oldIOhandler)();
|
int (*oldIOhandler)();
|
||||||
#endif
|
#endif
|
||||||
# ifdef ELAPSED_FUNC
|
# ifdef ELAPSED_FUNC
|
||||||
ELAPSED_TYPE start_tv;
|
elapsed_T start_tv;
|
||||||
|
|
||||||
if (p_verbose > 0)
|
if (p_verbose > 0)
|
||||||
ELAPSED_INIT(start_tv);
|
ELAPSED_INIT(start_tv);
|
||||||
|
@ -791,6 +791,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
770,
|
||||||
/**/
|
/**/
|
||||||
769,
|
769,
|
||||||
/**/
|
/**/
|
||||||
|
20
src/vim.h
20
src/vim.h
@ -2625,17 +2625,15 @@ typedef enum {
|
|||||||
# define ELAPSED_TIMEVAL
|
# define ELAPSED_TIMEVAL
|
||||||
# define ELAPSED_INIT(v) gettimeofday(&v, NULL)
|
# define ELAPSED_INIT(v) gettimeofday(&v, NULL)
|
||||||
# define ELAPSED_FUNC(v) elapsed(&v)
|
# define ELAPSED_FUNC(v) elapsed(&v)
|
||||||
# define ELAPSED_TYPE struct timeval
|
typedef struct timeval elapsed_T;
|
||||||
long elapsed(struct timeval *start_tv);
|
long elapsed(struct timeval *start_tv);
|
||||||
#else
|
#elif defined(WIN32)
|
||||||
# if defined(WIN32)
|
# define ELAPSED_TICKCOUNT
|
||||||
# define ELAPSED_TICKCOUNT
|
# define ELAPSED_INIT(v) v = GetTickCount()
|
||||||
# define ELAPSED_INIT(v) v = GetTickCount()
|
# define ELAPSED_FUNC(v) elapsed(v)
|
||||||
# define ELAPSED_FUNC(v) elapsed(v)
|
typedef DWORD elapsed_T;
|
||||||
# define ELAPSED_TYPE DWORD
|
# ifndef PROTO
|
||||||
# ifndef PROTO
|
long elapsed(DWORD start_tick);
|
||||||
long elapsed(DWORD start_tick);
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user