From 6eefd2422ef232aec2fe12465d9ec4018c63814d Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 19 Aug 2016 12:51:02 -0400 Subject: Remove typedef celt from the regex library, along with macro NOCELT. The regex library used to have a notion of a "collating element" that was distinct from a "character", but Henry Spencer never actually implemented his planned support for multi-character collating elements, and the Tcl crew ripped out most of the stubs for that years ago. The only thing left that distinguished the "celt" typedef from the "chr" typedef was that "celt" was supposed to also be able to hold the not-a-character "NOCELT" value. However, NOCELT was not used anywhere after the MCCE stub removal changes, which means there's no need for celt to be different from chr. Removing the separate typedef simplifies matters and also removes a trap for the unwary, in that celt is signed while chr may not be, so comparisons could mean different things. There's no bug there today because we restrict CHR_MAX to be less than INT_MAX, but I think there may have been such bugs before we did that, and there could be again if anyone ever decides to fool with the range of chr. This patch also removes assorted unnecessary casts to "chr" of values that are already chrs. Many of these seem to be leftover from days when the code was compatible with pre-ANSI C. --- src/backend/regex/regc_cvec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/backend/regex/regc_cvec.c') diff --git a/src/backend/regex/regc_cvec.c b/src/backend/regex/regc_cvec.c index 921a7d7f92a..3a9e8cfbbd7 100644 --- a/src/backend/regex/regc_cvec.c +++ b/src/backend/regex/regc_cvec.c @@ -78,7 +78,7 @@ addchr(struct cvec * cv, /* character vector */ chr c) /* character to add */ { assert(cv->nchrs < cv->chrspace); - cv->chrs[cv->nchrs++] = (chr) c; + cv->chrs[cv->nchrs++] = c; } /* @@ -90,8 +90,8 @@ addrange(struct cvec * cv, /* character vector */ chr to) /* last character of range */ { assert(cv->nranges < cv->rangespace); - cv->ranges[cv->nranges * 2] = (chr) from; - cv->ranges[cv->nranges * 2 + 1] = (chr) to; + cv->ranges[cv->nranges * 2] = from; + cv->ranges[cv->nranges * 2 + 1] = to; cv->nranges++; } -- cgit v1.2.3