Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Clean up another pre-ANSI-C-ism in regex code: get rid of pcolor typedef.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 19 Aug 2016 17:31:10 +0000 (13:31 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 19 Aug 2016 17:31:10 +0000 (13:31 -0400)
pcolor was used to represent function arguments that are nominally of
type color, but when using a pre-ANSI C compiler would be passed as the
promoted integer type.  We really don't need that anymore.

src/backend/regex/regc_color.c
src/backend/regex/regc_nfa.c
src/backend/regex/regcomp.c
src/backend/regex/rege_dfa.c
src/backend/regex/regexec.c
src/include/regex/regguts.h

index c495cee300394445d4a9c413d764174330962b49..8ffc8fb797d0e5340e4c968be2eeabb9af66250b 100644 (file)
@@ -148,7 +148,7 @@ cmtreefree(struct colormap * cm,
 static color                   /* previous color */
 setcolor(struct colormap * cm,
         chr c,
-        pcolor co)
+        color co)
 {
    uchr        uc = c;
    int         shift;
@@ -199,7 +199,7 @@ setcolor(struct colormap * cm,
 
    b = uc & BYTMASK;
    prev = t->tcolor[b];
-   t->tcolor[b] = (color) co;
+   t->tcolor[b] = co;
    return prev;
 }
 
@@ -293,7 +293,7 @@ newcolor(struct colormap * cm)
  */
 static void
 freecolor(struct colormap * cm,
-         pcolor co)
+         color co)
 {
    struct colordesc *cd = &cm->cd[co];
    color       pco,
@@ -393,7 +393,7 @@ subcolor(struct colormap * cm, chr c)
  */
 static color
 newsub(struct colormap * cm,
-      pcolor co)
+      color co)
 {
    color       sco;            /* new subcolor */
 
@@ -658,7 +658,7 @@ static void
 rainbow(struct nfa * nfa,
        struct colormap * cm,
        int type,
-       pcolor but,             /* COLORLESS if no exceptions */
+       color but,              /* COLORLESS if no exceptions */
        struct state * from,
        struct state * to)
 {
index cd9a3239bd3267c2da7ea42d00e0baadc60d0d41..90dca5d9dea39d6239a4ad9cf5a3119d04526611 100644 (file)
@@ -275,7 +275,7 @@ destroystate(struct nfa * nfa,
 static void
 newarc(struct nfa * nfa,
       int t,
-      pcolor co,
+      color co,
       struct state * from,
       struct state * to)
 {
@@ -321,7 +321,7 @@ newarc(struct nfa * nfa,
 static void
 createarc(struct nfa * nfa,
          int t,
-         pcolor co,
+         color co,
          struct state * from,
          struct state * to)
 {
@@ -334,7 +334,7 @@ createarc(struct nfa * nfa,
    assert(a != NULL);
 
    a->type = t;
-   a->co = (color) co;
+   a->co = co;
    a->to = to;
    a->from = from;
 
@@ -553,7 +553,7 @@ hasnonemptyout(struct state * s)
 static struct arc *
 findarc(struct state * s,
        int type,
-       pcolor co)
+       color co)
 {
    struct arc *a;
 
index 48d63da11de1d0f0689b9dce1cd942eadc15fd9c..b211cc0a189f7d6d06f5986ba85899219d0a01d0 100644 (file)
@@ -97,19 +97,19 @@ static chr  chrnamed(struct vars *, const chr *, const chr *, chr);
 static void initcm(struct vars *, struct colormap *);
 static void freecm(struct colormap *);
 static void cmtreefree(struct colormap *, union tree *, int);
-static color setcolor(struct colormap *, chr, pcolor);
+static color setcolor(struct colormap *, chr, color);
 static color maxcolor(struct colormap *);
 static color newcolor(struct colormap *);
-static void freecolor(struct colormap *, pcolor);
+static void freecolor(struct colormap *, color);
 static color pseudocolor(struct colormap *);
 static color subcolor(struct colormap *, chr c);
-static color newsub(struct colormap *, pcolor);
+static color newsub(struct colormap *, color);
 static void subrange(struct vars *, chr, chr, struct state *, struct state *);
 static void subblock(struct vars *, chr, struct state *, struct state *);
 static void okcolors(struct nfa *, struct colormap *);
 static void colorchain(struct colormap *, struct arc *);
 static void uncolorchain(struct colormap *, struct arc *);
-static void rainbow(struct nfa *, struct colormap *, int, pcolor, struct state *, struct state *);
+static void rainbow(struct nfa *, struct colormap *, int, color, struct state *, struct state *);
 static void colorcomplement(struct nfa *, struct colormap *, int, struct state *, struct state *, struct state *);
 
 #ifdef REG_DEBUG
@@ -125,13 +125,13 @@ static struct state *newfstate(struct nfa *, int flag);
 static void dropstate(struct nfa *, struct state *);
 static void freestate(struct nfa *, struct state *);
 static void destroystate(struct nfa *, struct state *);
-static void newarc(struct nfa *, int, pcolor, struct state *, struct state *);
-static void createarc(struct nfa *, int, pcolor, struct state *, struct state *);
+static void newarc(struct nfa *, int, color, struct state *, struct state *);
+static void createarc(struct nfa *, int, color, struct state *, struct state *);
 static struct arc *allocarc(struct nfa *, struct state *);
 static void freearc(struct nfa *, struct arc *);
 static void changearctarget(struct arc *, struct state *);
 static int hasnonemptyout(struct state *);
-static struct arc *findarc(struct state *, int, pcolor);
+static struct arc *findarc(struct state *, int, color);
 static void cparc(struct nfa *, struct arc *, struct state *, struct state *);
 static void sortins(struct nfa *, struct state *);
 static int sortins_cmp(const void *, const void *);
index 7d90242acefd50b33fc7c2551e1cf830b5752fee..b98c9d39021273bffe193ce8719e3b65c647c1c9 100644 (file)
@@ -603,7 +603,7 @@ static struct sset *
 miss(struct vars * v,
     struct dfa * d,
     struct sset * css,
-    pcolor co,
+    color co,
     chr *cp,                   /* next chr */
     chr *start)                /* where the attempt got started */
 {
@@ -731,7 +731,7 @@ miss(struct vars * v,
        css->outs[co] = p;
        css->inchain[co] = p->ins;
        p->ins.ss = css;
-       p->ins.co = (color) co;
+       p->ins.co = co;
    }
    return p;
 }
@@ -743,7 +743,7 @@ static int                      /* predicate:  constraint satisfied? */
 lacon(struct vars * v,
      struct cnfa * pcnfa,      /* parent cnfa */
      chr *cp,
-     pcolor co)                /* "color" of the lookaround constraint */
+     color co)                 /* "color" of the lookaround constraint */
 {
    int         n;
    struct subre *sub;
index 82659a0f2f468532662ac29583c9f536e727a1be..5cbfd9b151b15d43474824acc773b98fd0b2d564 100644 (file)
@@ -159,8 +159,8 @@ static struct dfa *newdfa(struct vars *, struct cnfa *, struct colormap *, struc
 static void freedfa(struct dfa *);
 static unsigned hash(unsigned *, int);
 static struct sset *initialize(struct vars *, struct dfa *, chr *);
-static struct sset *miss(struct vars *, struct dfa *, struct sset *, pcolor, chr *, chr *);
-static int lacon(struct vars *, struct cnfa *, chr *, pcolor);
+static struct sset *miss(struct vars *, struct dfa *, struct sset *, color, chr *, chr *);
+static int lacon(struct vars *, struct cnfa *, chr *, color);
 static struct sset *getvacant(struct vars *, struct dfa *, chr *, chr *);
 static struct sset *pickss(struct vars *, struct dfa *, chr *, chr *);
 
index 2ceffa6563b04b7b9024f7dbebf2c37a8c392c31..b0aa641cc4f6d851e19b3635edb9a8d3ddfbeaeb 100644 (file)
  * which are of much more manageable number.
  */
 typedef short color;           /* colors of characters */
-typedef int pcolor;                /* what color promotes to */
 
 #define MAX_COLOR  32767       /* max color (must fit in 'color' datatype) */
 #define COLORLESS  (-1)        /* impossible color */