Mercurial > vim
comparison src/os_unix.c @ 15525:3ef31ce9d9f9 v8.1.0770
patch 8.1.0770: inconsistent use of ELAPSED_FUNC
commit https://github.com/vim/vim/commit/1ac56c2d11da5ffa44db23e1fd0c533d02ab2f66
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 17 22:28:22 2019 +0100
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)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 17 Jan 2019 22:30:06 +0100 |
parents | 55ccc2d353bd |
children | dd725a8ab112 |
comparison
equal
deleted
inserted
replaced
15524:c51e8d9f4384 | 15525:3ef31ce9d9f9 |
---|---|
372 int interrupted = FALSE; | 372 int interrupted = FALSE; |
373 int did_start_blocking = FALSE; | 373 int did_start_blocking = FALSE; |
374 long wait_time; | 374 long wait_time; |
375 long elapsed_time = 0; | 375 long elapsed_time = 0; |
376 #ifdef ELAPSED_FUNC | 376 #ifdef ELAPSED_FUNC |
377 ELAPSED_TYPE start_tv; | 377 elapsed_T start_tv; |
378 | 378 |
379 ELAPSED_INIT(start_tv); | 379 ELAPSED_INIT(start_tv); |
380 #endif | 380 #endif |
381 | 381 |
382 /* repeat until we got a character or waited long enough */ | 382 /* repeat until we got a character or waited long enough */ |
478 return len; | 478 return len; |
479 continue; | 479 continue; |
480 } | 480 } |
481 | 481 |
482 /* no character available */ | 482 /* no character available */ |
483 #if !(defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)) | 483 #ifndef ELAPSED_FUNC |
484 /* estimate the elapsed time */ | 484 /* estimate the elapsed time */ |
485 elapsed_time += wait_time; | 485 elapsed_time += wait_time; |
486 #endif | 486 #endif |
487 | 487 |
488 if (do_resize /* interrupted by SIGWINCH signal */ | 488 if (do_resize /* interrupted by SIGWINCH signal */ |
1905 if (x11_window != 0 && x11_display == NULL) | 1905 if (x11_window != 0 && x11_display == NULL) |
1906 { | 1906 { |
1907 #ifdef SET_SIG_ALARM | 1907 #ifdef SET_SIG_ALARM |
1908 RETSIGTYPE (*sig_save)(); | 1908 RETSIGTYPE (*sig_save)(); |
1909 #endif | 1909 #endif |
1910 #if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) | 1910 #ifdef ELAPSED_FUNC |
1911 struct timeval start_tv; | 1911 elapsed_T start_tv; |
1912 | 1912 |
1913 if (p_verbose > 0) | 1913 if (p_verbose > 0) |
1914 gettimeofday(&start_tv, NULL); | 1914 ELAPSED_INIT(start_tv); |
1915 #endif | 1915 #endif |
1916 | 1916 |
1917 #ifdef SET_SIG_ALARM | 1917 #ifdef SET_SIG_ALARM |
1918 /* | 1918 /* |
1919 * Opening the Display may hang if the DISPLAY setting is wrong, or | 1919 * Opening the Display may hang if the DISPLAY setting is wrong, or |
4829 int c; | 4829 int c; |
4830 int toshell_fd; | 4830 int toshell_fd; |
4831 int fromshell_fd; | 4831 int fromshell_fd; |
4832 garray_T ga; | 4832 garray_T ga; |
4833 int noread_cnt; | 4833 int noread_cnt; |
4834 # if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) | 4834 # ifdef ELAPSED_FUNC |
4835 struct timeval start_tv; | 4835 elapsed_T start_tv; |
4836 # endif | 4836 # endif |
4837 | 4837 |
4838 # ifdef FEAT_GUI | 4838 # ifdef FEAT_GUI |
4839 if (pty_master_fd >= 0) | 4839 if (pty_master_fd >= 0) |
4840 { | 4840 { |
6071 # define MAY_LOOP | 6071 # define MAY_LOOP |
6072 | 6072 |
6073 # ifdef ELAPSED_FUNC | 6073 # ifdef ELAPSED_FUNC |
6074 /* Remember at what time we started, so that we know how much longer we | 6074 /* Remember at what time we started, so that we know how much longer we |
6075 * should wait after being interrupted. */ | 6075 * should wait after being interrupted. */ |
6076 long start_msec = msec; | 6076 long start_msec = msec; |
6077 ELAPSED_TYPE start_tv; | 6077 elapsed_T start_tv; |
6078 | 6078 |
6079 if (msec > 0) | 6079 if (msec > 0) |
6080 ELAPSED_INIT(start_tv); | 6080 ELAPSED_INIT(start_tv); |
6081 # endif | 6081 # endif |
6082 | 6082 |
7492 int (*oldhandler)(); | 7492 int (*oldhandler)(); |
7493 #if defined(HAVE_SETJMP_H) | 7493 #if defined(HAVE_SETJMP_H) |
7494 int (*oldIOhandler)(); | 7494 int (*oldIOhandler)(); |
7495 #endif | 7495 #endif |
7496 # ifdef ELAPSED_FUNC | 7496 # ifdef ELAPSED_FUNC |
7497 ELAPSED_TYPE start_tv; | 7497 elapsed_T start_tv; |
7498 | 7498 |
7499 if (p_verbose > 0) | 7499 if (p_verbose > 0) |
7500 ELAPSED_INIT(start_tv); | 7500 ELAPSED_INIT(start_tv); |
7501 # endif | 7501 # endif |
7502 | 7502 |