Commit a859e640 authored by Tom Lane's avatar Tom Lane

Clean up another pre-ANSI-C-ism in regex code: get rid of pcolor typedef.

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.
parent 6eefd242
...@@ -148,7 +148,7 @@ cmtreefree(struct colormap * cm, ...@@ -148,7 +148,7 @@ cmtreefree(struct colormap * cm,
static color /* previous color */ static color /* previous color */
setcolor(struct colormap * cm, setcolor(struct colormap * cm,
chr c, chr c,
pcolor co) color co)
{ {
uchr uc = c; uchr uc = c;
int shift; int shift;
...@@ -199,7 +199,7 @@ setcolor(struct colormap * cm, ...@@ -199,7 +199,7 @@ setcolor(struct colormap * cm,
b = uc & BYTMASK; b = uc & BYTMASK;
prev = t->tcolor[b]; prev = t->tcolor[b];
t->tcolor[b] = (color) co; t->tcolor[b] = co;
return prev; return prev;
} }
...@@ -293,7 +293,7 @@ newcolor(struct colormap * cm) ...@@ -293,7 +293,7 @@ newcolor(struct colormap * cm)
*/ */
static void static void
freecolor(struct colormap * cm, freecolor(struct colormap * cm,
pcolor co) color co)
{ {
struct colordesc *cd = &cm->cd[co]; struct colordesc *cd = &cm->cd[co];
color pco, color pco,
...@@ -393,7 +393,7 @@ subcolor(struct colormap * cm, chr c) ...@@ -393,7 +393,7 @@ subcolor(struct colormap * cm, chr c)
*/ */
static color static color
newsub(struct colormap * cm, newsub(struct colormap * cm,
pcolor co) color co)
{ {
color sco; /* new subcolor */ color sco; /* new subcolor */
...@@ -658,7 +658,7 @@ static void ...@@ -658,7 +658,7 @@ static void
rainbow(struct nfa * nfa, rainbow(struct nfa * nfa,
struct colormap * cm, struct colormap * cm,
int type, int type,
pcolor but, /* COLORLESS if no exceptions */ color but, /* COLORLESS if no exceptions */
struct state * from, struct state * from,
struct state * to) struct state * to)
{ {
......
...@@ -275,7 +275,7 @@ destroystate(struct nfa * nfa, ...@@ -275,7 +275,7 @@ destroystate(struct nfa * nfa,
static void static void
newarc(struct nfa * nfa, newarc(struct nfa * nfa,
int t, int t,
pcolor co, color co,
struct state * from, struct state * from,
struct state * to) struct state * to)
{ {
...@@ -321,7 +321,7 @@ newarc(struct nfa * nfa, ...@@ -321,7 +321,7 @@ newarc(struct nfa * nfa,
static void static void
createarc(struct nfa * nfa, createarc(struct nfa * nfa,
int t, int t,
pcolor co, color co,
struct state * from, struct state * from,
struct state * to) struct state * to)
{ {
...@@ -334,7 +334,7 @@ createarc(struct nfa * nfa, ...@@ -334,7 +334,7 @@ createarc(struct nfa * nfa,
assert(a != NULL); assert(a != NULL);
a->type = t; a->type = t;
a->co = (color) co; a->co = co;
a->to = to; a->to = to;
a->from = from; a->from = from;
...@@ -553,7 +553,7 @@ hasnonemptyout(struct state * s) ...@@ -553,7 +553,7 @@ hasnonemptyout(struct state * s)
static struct arc * static struct arc *
findarc(struct state * s, findarc(struct state * s,
int type, int type,
pcolor co) color co)
{ {
struct arc *a; struct arc *a;
......
...@@ -97,19 +97,19 @@ static chr chrnamed(struct vars *, const chr *, const chr *, chr); ...@@ -97,19 +97,19 @@ static chr chrnamed(struct vars *, const chr *, const chr *, chr);
static void initcm(struct vars *, struct colormap *); static void initcm(struct vars *, struct colormap *);
static void freecm(struct colormap *); static void freecm(struct colormap *);
static void cmtreefree(struct colormap *, union tree *, int); 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 maxcolor(struct colormap *);
static color newcolor(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 pseudocolor(struct colormap *);
static color subcolor(struct colormap *, chr c); 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 subrange(struct vars *, chr, chr, struct state *, struct state *);
static void subblock(struct vars *, chr, struct state *, struct state *); static void subblock(struct vars *, chr, struct state *, struct state *);
static void okcolors(struct nfa *, struct colormap *); static void okcolors(struct nfa *, struct colormap *);
static void colorchain(struct colormap *, struct arc *); static void colorchain(struct colormap *, struct arc *);
static void uncolorchain(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 *); static void colorcomplement(struct nfa *, struct colormap *, int, struct state *, struct state *, struct state *);
#ifdef REG_DEBUG #ifdef REG_DEBUG
...@@ -125,13 +125,13 @@ static struct state *newfstate(struct nfa *, int flag); ...@@ -125,13 +125,13 @@ static struct state *newfstate(struct nfa *, int flag);
static void dropstate(struct nfa *, struct state *); static void dropstate(struct nfa *, struct state *);
static void freestate(struct nfa *, struct state *); static void freestate(struct nfa *, struct state *);
static void destroystate(struct nfa *, struct state *); static void destroystate(struct nfa *, struct state *);
static void newarc(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, pcolor, struct state *, struct state *); static void createarc(struct nfa *, int, color, struct state *, struct state *);
static struct arc *allocarc(struct nfa *, struct state *); static struct arc *allocarc(struct nfa *, struct state *);
static void freearc(struct nfa *, struct arc *); static void freearc(struct nfa *, struct arc *);
static void changearctarget(struct arc *, struct state *); static void changearctarget(struct arc *, struct state *);
static int hasnonemptyout(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 cparc(struct nfa *, struct arc *, struct state *, struct state *);
static void sortins(struct nfa *, struct state *); static void sortins(struct nfa *, struct state *);
static int sortins_cmp(const void *, const void *); static int sortins_cmp(const void *, const void *);
......
...@@ -603,7 +603,7 @@ static struct sset * ...@@ -603,7 +603,7 @@ static struct sset *
miss(struct vars * v, miss(struct vars * v,
struct dfa * d, struct dfa * d,
struct sset * css, struct sset * css,
pcolor co, color co,
chr *cp, /* next chr */ chr *cp, /* next chr */
chr *start) /* where the attempt got started */ chr *start) /* where the attempt got started */
{ {
...@@ -731,7 +731,7 @@ miss(struct vars * v, ...@@ -731,7 +731,7 @@ miss(struct vars * v,
css->outs[co] = p; css->outs[co] = p;
css->inchain[co] = p->ins; css->inchain[co] = p->ins;
p->ins.ss = css; p->ins.ss = css;
p->ins.co = (color) co; p->ins.co = co;
} }
return p; return p;
} }
...@@ -743,7 +743,7 @@ static int /* predicate: constraint satisfied? */ ...@@ -743,7 +743,7 @@ static int /* predicate: constraint satisfied? */
lacon(struct vars * v, lacon(struct vars * v,
struct cnfa * pcnfa, /* parent cnfa */ struct cnfa * pcnfa, /* parent cnfa */
chr *cp, chr *cp,
pcolor co) /* "color" of the lookaround constraint */ color co) /* "color" of the lookaround constraint */
{ {
int n; int n;
struct subre *sub; struct subre *sub;
......
...@@ -159,8 +159,8 @@ static struct dfa *newdfa(struct vars *, struct cnfa *, struct colormap *, struc ...@@ -159,8 +159,8 @@ static struct dfa *newdfa(struct vars *, struct cnfa *, struct colormap *, struc
static void freedfa(struct dfa *); static void freedfa(struct dfa *);
static unsigned hash(unsigned *, int); static unsigned hash(unsigned *, int);
static struct sset *initialize(struct vars *, struct dfa *, chr *); static struct sset *initialize(struct vars *, struct dfa *, chr *);
static struct sset *miss(struct vars *, struct dfa *, struct sset *, pcolor, chr *, chr *); static struct sset *miss(struct vars *, struct dfa *, struct sset *, color, chr *, chr *);
static int lacon(struct vars *, struct cnfa *, chr *, pcolor); static int lacon(struct vars *, struct cnfa *, chr *, color);
static struct sset *getvacant(struct vars *, struct dfa *, chr *, chr *); static struct sset *getvacant(struct vars *, struct dfa *, chr *, chr *);
static struct sset *pickss(struct vars *, struct dfa *, chr *, chr *); static struct sset *pickss(struct vars *, struct dfa *, chr *, chr *);
......
...@@ -149,7 +149,6 @@ ...@@ -149,7 +149,6 @@
* which are of much more manageable number. * which are of much more manageable number.
*/ */
typedef short color; /* colors of characters */ 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 MAX_COLOR 32767 /* max color (must fit in 'color' datatype) */
#define COLORLESS (-1) /* impossible color */ #define COLORLESS (-1) /* impossible color */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment