diff options
Diffstat (limited to 'src/backend/regex/regc_color.c')
-rw-r--r-- | src/backend/regex/regc_color.c | 35 |
1 files changed, 10 insertions, 25 deletions
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++; @@ -635,21 +635,6 @@ uncolorchain(struct colormap * cm, } /* - * 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 */ static void |