From df1e965e12cdd48c11057ee6e15346ee2b8b02f5 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 14 Feb 2008 17:33:37 +0000 Subject: Sync our regex code with upstream changes since last time we did this, which was Tcl 8.4.8. The main changes are to remove the never-fully-implemented code for multi-character collating elements, and to const-ify some stuff a bit more fully. In combination with the recent security patch, this commit brings us into line with Tcl 8.5.0. Note that I didn't make any effort to duplicate a lot of cosmetic changes that they made to bring their copy into line with their own style guidelines, such as adding braces around single-line IF bodies. Most of those we either had done already (such as ANSI-fication of function headers) or there is no point because pgindent would undo the change anyway. --- src/backend/regex/regc_color.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) (limited to 'src/backend/regex/regc_color.c') diff --git a/src/backend/regex/regc_color.c b/src/backend/regex/regc_color.c index 87eb1e4958a..e15fd4b788e 100644 --- a/src/backend/regex/regc_color.c +++ b/src/backend/regex/regc_color.c @@ -28,7 +28,7 @@ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $PostgreSQL: pgsql/src/backend/regex/regc_color.c,v 1.8 2008/01/03 20:47:55 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/regex/regc_color.c,v 1.9 2008/02/14 17:33:37 tgl Exp $ * * * Note that there are some incestuous relationships between this code and @@ -222,7 +222,6 @@ static color /* COLORLESS for error */ newcolor(struct colormap * cm) { struct colordesc *cd; - struct colordesc *new; size_t n; if (CISERR()) @@ -245,24 +244,25 @@ newcolor(struct colormap * cm) else { /* oops, must allocate more */ + struct colordesc *newCd; + n = cm->ncds * 2; if (cm->cd == cm->cdspace) { - new = (struct colordesc *) MALLOC(n * - sizeof(struct colordesc)); - if (new != NULL) - memcpy(VS(new), VS(cm->cdspace), cm->ncds * + newCd = (struct colordesc *) MALLOC(n * sizeof(struct colordesc)); + if (newCd != NULL) + memcpy(VS(newCd), VS(cm->cdspace), cm->ncds * sizeof(struct colordesc)); } else - new = (struct colordesc *) REALLOC(cm->cd, - n * sizeof(struct colordesc)); - if (new == NULL) + newCd = (struct colordesc *) + REALLOC(cm->cd, n * sizeof(struct colordesc)); + if (newCd == NULL) { CERR(REG_ESPACE); return COLORLESS; } - cm->cd = new; + cm->cd = newCd; cm->ncds = n; assert(cm->max < cm->ncds - 1); cm->max++; @@ -634,21 +634,6 @@ uncolorchain(struct colormap * cm, a->colorchainRev = NULL; } -/* - * singleton - is this character in its own color? - */ -static int /* predicate */ -singleton(struct colormap * cm, - chr c) -{ - color co; /* color of c */ - - co = GETCOLOR(cm, c); - if (cm->cd[co].nchrs == 1 && cm->cd[co].sub == NOSUB) - return 1; - return 0; -} - /* * rainbow - add arcs of all full colors (but one) between specified states */ -- cgit v1.2.3