diff options
| author | Karl Heuer | 1994-03-14 21:44:12 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-03-14 21:44:12 +0000 |
| commit | b2c71fb43cce2e41e6942e9489eab007cf32f5f5 (patch) | |
| tree | 5253519c3bec3e3ca75e77b11fb003be2a192a51 /src | |
| parent | 484ab76a03aaacb8fab20396f1f8055001a69459 (diff) | |
| download | emacs-b2c71fb43cce2e41e6942e9489eab007cf32f5f5.tar.gz emacs-b2c71fb43cce2e41e6942e9489eab007cf32f5f5.zip | |
(search_buffer): Avoid boolean/integer mixing that confuses some compilers.
Diffstat (limited to 'src')
| -rw-r--r-- | src/search.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/search.c b/src/search.c index e24a2019086..45d3f52fe90 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -822,7 +822,10 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt) | |||
| 822 | of pattern would align in a possible match. */ | 822 | of pattern would align in a possible match. */ |
| 823 | while (n != 0) | 823 | while (n != 0) |
| 824 | { | 824 | { |
| 825 | if ((lim - pos - (direction > 0)) * direction < 0) | 825 | /* It's been reported that some (broken) compiler thinks that |
| 826 | Boolean expressions in an arithmetic context are unsigned. | ||
| 827 | Using an explicit ?1:0 prevents this. */ | ||
| 828 | if ((lim - pos - ((direction > 0) ? 1 : 0)) * direction < 0) | ||
| 826 | return (n * (0 - direction)); | 829 | return (n * (0 - direction)); |
| 827 | /* First we do the part we can by pointers (maybe nothing) */ | 830 | /* First we do the part we can by pointers (maybe nothing) */ |
| 828 | QUIT; | 831 | QUIT; |