aboutsummaryrefslogtreecommitdiff
path: root/src/include/regex/regcustom.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-08-19 12:51:02 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-08-19 12:51:02 -0400
commit6eefd2422ef232aec2fe12465d9ec4018c63814d (patch)
tree46a1f842fc9ba2e0db3b6fe471f32cce93892d5d /src/include/regex/regcustom.h
parent5285c5e873d8b622da7007c1628e5afa80f372fb (diff)
downloadpostgresql-6eefd2422ef232aec2fe12465d9ec4018c63814d.tar.gz
postgresql-6eefd2422ef232aec2fe12465d9ec4018c63814d.zip
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.
Diffstat (limited to 'src/include/regex/regcustom.h')
-rw-r--r--src/include/regex/regcustom.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/include/regex/regcustom.h b/src/include/regex/regcustom.h
index 60034daee83..459851a7f6b 100644
--- a/src/include/regex/regcustom.h
+++ b/src/include/regex/regcustom.h
@@ -58,15 +58,13 @@
/* internal character type and related */
typedef pg_wchar chr; /* the type itself */
typedef unsigned uchr; /* unsigned type that will hold a chr */
-typedef int celt; /* type to hold chr, or NOCELT */
-#define NOCELT (-1) /* celt value which is not valid chr */
#define CHR(c) ((unsigned char) (c)) /* turn char literal into chr literal */
#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
#define CHRBITS 32 /* bits in a chr; must not use sizeof */
#define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
#define CHR_MAX 0x7ffffffe /* CHR_MAX-CHR_MIN+1 must fit in an int, and
- * CHR_MAX+1 must fit in both chr and celt */
+ * CHR_MAX+1 must fit in a chr variable */
/*
* Check if a chr value is in range. Ideally we'd just write this as