summaryrefslogtreecommitdiff
path: root/src/search.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-03-14 21:44:12 +0000
committerKarl Heuer <kwzh@gnu.org>1994-03-14 21:44:12 +0000
commitb2c71fb43cce2e41e6942e9489eab007cf32f5f5 (patch)
tree5253519c3bec3e3ca75e77b11fb003be2a192a51 /src/search.c
parent484ab76a03aaacb8fab20396f1f8055001a69459 (diff)
downloademacs-b2c71fb43cce2e41e6942e9489eab007cf32f5f5.tar.gz
(search_buffer): Avoid boolean/integer mixing that confuses some compilers.
Diffstat (limited to 'src/search.c')
-rw-r--r--src/search.c5
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)
of pattern would align in a possible match. */
while (n != 0)
{
- if ((lim - pos - (direction > 0)) * direction < 0)
+ /* It's been reported that some (broken) compiler thinks that
+ Boolean expressions in an arithmetic context are unsigned.
+ Using an explicit ?1:0 prevents this. */
+ if ((lim - pos - ((direction > 0) ? 1 : 0)) * direction < 0)
return (n * (0 - direction));
/* First we do the part we can by pointers (maybe nothing) */
QUIT;