From cf1982d9eae60b56c260cad53ab725acdfc122f9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 24 Apr 2005 16:41:14 +0000 Subject: [PATCH] (re_search_2, re_match_2_internal): Convert second arg of RE_TRANSLATE to int, to shut up GCC warnings. --- src/ChangeLog | 3 +++ src/regex.c | 26 +++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 4de54bcb7b1..e239b41a66f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2005-04-24 Eli Zaretskii + * regex.c (re_search_2, re_match_2_internal): Convert second arg + of RE_TRANSLATE to int, to shut up GCC warnings. + * fileio.c (Fcopy_file): Doc fix. [MSDOS]: Fix call to emacs_open: buffer_file_type not defined and not needed. diff --git a/src/regex.c b/src/regex.c index a223f170765..44feee4cddf 100644 --- a/src/regex.c +++ b/src/regex.c @@ -4290,12 +4290,19 @@ re_search_2 (bufp, str1, size1, str2, size2, startpos, range, regs, stop) d += buf_charlen; } else - while (range > lim - && !fastmap[RE_TRANSLATE (translate, *d)]) - { - d++; - range--; - } + { + /* Convert *d to integer to shut up GCC's + whining about comparison that is always + true. */ + int di = *d; + + while (range > lim + && !fastmap[RE_TRANSLATE (translate, di)]) + { + di = *(++d); + range--; + } + } } else while (range > lim && !fastmap[*d]) @@ -5244,8 +5251,13 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) else do { + /* Avoid compiler whining about comparison being + always true. */ + int di; + PREFETCH (); - if (RE_TRANSLATE (translate, *d) != *p++) + di = *d; + if (RE_TRANSLATE (translate, di) != *p++) { d = dfail; goto fail; -- 2.39.2