diff options
| author | Paul Eggert | 2012-07-06 09:57:32 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-06 09:57:32 -0700 |
| commit | 216ee680e5c7e34177eedab9256a85042804545c (patch) | |
| tree | 80528da450f41a75408032bd7a6aa9a0784c6f9f /src/process.c | |
| parent | 5293d7586494b9ca1eb02979a0e59ca9fc8b87e6 (diff) | |
| download | emacs-216ee680e5c7e34177eedab9256a85042804545c.tar.gz emacs-216ee680e5c7e34177eedab9256a85042804545c.zip | |
* process.c: Avoid unnecessary calls to gettime.
(wait_reading_process_output): Don't get the time of day
when gobbling data immediately and not waiting, as there's no need
for it in that case. This removes a FIXME.
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/process.c b/src/process.c index 2cb9e8de15f..f7ecd9b05a7 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -4307,7 +4307,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4307 | 4307 | ||
| 4308 | /* Since we may need to wait several times, | 4308 | /* Since we may need to wait several times, |
| 4309 | compute the absolute time to return at. */ | 4309 | compute the absolute time to return at. */ |
| 4310 | if (time_limit || nsecs) /* FIXME neither should be negative, no? */ | 4310 | if (time_limit || 0 < nsecs) |
| 4311 | { | 4311 | { |
| 4312 | EMACS_GET_TIME (end_time); | 4312 | EMACS_GET_TIME (end_time); |
| 4313 | EMACS_SET_SECS_NSECS (timeout, time_limit, nsecs); | 4313 | EMACS_SET_SECS_NSECS (timeout, time_limit, nsecs); |
| @@ -4336,13 +4336,13 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4336 | /* Exit if already run out */ | 4336 | /* Exit if already run out */ |
| 4337 | if (nsecs < 0) | 4337 | if (nsecs < 0) |
| 4338 | { | 4338 | { |
| 4339 | /* -1 specified for timeout means | 4339 | /* A negative timeout means |
| 4340 | gobble output available now | 4340 | gobble output available now |
| 4341 | but don't wait at all. */ | 4341 | but don't wait at all. */ |
| 4342 | 4342 | ||
| 4343 | EMACS_SET_SECS_USECS (timeout, 0, 0); | 4343 | EMACS_SET_SECS_USECS (timeout, 0, 0); |
| 4344 | } | 4344 | } |
| 4345 | else if (time_limit || nsecs) | 4345 | else if (time_limit || 0 < nsecs) |
| 4346 | { | 4346 | { |
| 4347 | EMACS_GET_TIME (timeout); | 4347 | EMACS_GET_TIME (timeout); |
| 4348 | if (EMACS_TIME_LE (end_time, timeout)) | 4348 | if (EMACS_TIME_LE (end_time, timeout)) |
| @@ -4393,7 +4393,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4393 | && requeued_events_pending_p ()) | 4393 | && requeued_events_pending_p ()) |
| 4394 | break; | 4394 | break; |
| 4395 | 4395 | ||
| 4396 | /* If time_limit is negative, we are not going to wait at all. */ | 4396 | /* A negative timeout means do not wait at all. */ |
| 4397 | if (0 <= nsecs) | 4397 | if (0 <= nsecs) |
| 4398 | { | 4398 | { |
| 4399 | if (EMACS_TIME_VALID_P (timer_delay)) | 4399 | if (EMACS_TIME_VALID_P (timer_delay)) |
| @@ -4661,7 +4661,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 4661 | do_pending_window_change (0); | 4661 | do_pending_window_change (0); |
| 4662 | 4662 | ||
| 4663 | if ((time_limit || nsecs) && nfds == 0 && ! timeout_reduced_for_timers) | 4663 | if ((time_limit || nsecs) && nfds == 0 && ! timeout_reduced_for_timers) |
| 4664 | /* We wanted the full specified time, so return now. */ | 4664 | /* We waited the full specified time, so return now. */ |
| 4665 | break; | 4665 | break; |
| 4666 | if (nfds < 0) | 4666 | if (nfds < 0) |
| 4667 | { | 4667 | { |
| @@ -6855,7 +6855,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6855 | time_limit = TYPE_MAXIMUM (time_t); | 6855 | time_limit = TYPE_MAXIMUM (time_t); |
| 6856 | 6856 | ||
| 6857 | /* What does time_limit really mean? */ | 6857 | /* What does time_limit really mean? */ |
| 6858 | if (time_limit || nsecs) /* FIXME: what if negative? */ | 6858 | if (time_limit || 0 < nsecs) |
| 6859 | { | 6859 | { |
| 6860 | EMACS_GET_TIME (end_time); | 6860 | EMACS_GET_TIME (end_time); |
| 6861 | EMACS_SET_SECS_NSECS (timeout, time_limit, nsecs); | 6861 | EMACS_SET_SECS_NSECS (timeout, time_limit, nsecs); |
| @@ -6886,13 +6886,13 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, | |||
| 6886 | /* Exit if already run out */ | 6886 | /* Exit if already run out */ |
| 6887 | if (nsecs < 0) | 6887 | if (nsecs < 0) |
| 6888 | { | 6888 | { |
| 6889 | /* -1 specified for timeout means | 6889 | /* A negative timeout means |
| 6890 | gobble output available now | 6890 | gobble output available now |
| 6891 | but don't wait at all. */ | 6891 | but don't wait at all. */ |
| 6892 | 6892 | ||
| 6893 | EMACS_SET_SECS_USECS (timeout, 0, 0); | 6893 | EMACS_SET_SECS_USECS (timeout, 0, 0); |
| 6894 | } | 6894 | } |
| 6895 | else if (time_limit || nsecs) | 6895 | else if (time_limit || 0 < nsecs) |
| 6896 | { | 6896 | { |
| 6897 | EMACS_GET_TIME (timeout); | 6897 | EMACS_GET_TIME (timeout); |
| 6898 | if (EMACS_TIME_LE (end_time, timeout)) | 6898 | if (EMACS_TIME_LE (end_time, timeout)) |