patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Problem: Using gettimeofday() for timeout is very inefficient.
Solution: Set a platform dependent timer. (Paul Ollis, closes #10505)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index f75d8c7..20d9520 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -417,7 +417,6 @@
int found; // do_search() result
pos_T end_pos;
#ifdef FEAT_RELTIME
- proftime_T tm;
searchit_arg_T sia;
#endif
int next_char;
@@ -484,10 +483,6 @@
cursor_off(); // so the user knows we're busy
out_flush();
++emsg_off; // so it doesn't beep if bad expr
-#ifdef FEAT_RELTIME
- // Set the time limit to half a second.
- profile_setlimit(500L, &tm);
-#endif
if (!p_hls)
search_flags += SEARCH_KEEP;
if (search_first_line != 0)
@@ -495,7 +490,8 @@
ccline.cmdbuff[skiplen + patlen] = NUL;
#ifdef FEAT_RELTIME
CLEAR_FIELD(sia);
- sia.sa_tm = &tm;
+ // Set the time limit to half a second.
+ sia.sa_tm = 500;
#endif
found = do_search(NULL, firstc == ':' ? '/' : firstc, search_delim,
ccline.cmdbuff + skiplen, count, search_flags,