Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita859e64

Browse files
committed
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 oftype color, but when using a pre-ANSI C compiler would be passed as thepromoted integer type. We really don't need that anymore.
1 parent6eefd24 commita859e64

File tree

6 files changed

+21
-22
lines changed

6 files changed

+21
-22
lines changed

‎src/backend/regex/regc_color.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ cmtreefree(struct colormap * cm,
148148
staticcolor/* previous color */
149149
setcolor(structcolormap*cm,
150150
chrc,
151-
pcolorco)
151+
colorco)
152152
{
153153
uchruc=c;
154154
intshift;
@@ -199,7 +199,7 @@ setcolor(struct colormap * cm,
199199

200200
b=uc&BYTMASK;
201201
prev=t->tcolor[b];
202-
t->tcolor[b]=(color)co;
202+
t->tcolor[b]=co;
203203
returnprev;
204204
}
205205

@@ -293,7 +293,7 @@ newcolor(struct colormap * cm)
293293
*/
294294
staticvoid
295295
freecolor(structcolormap*cm,
296-
pcolorco)
296+
colorco)
297297
{
298298
structcolordesc*cd=&cm->cd[co];
299299
colorpco,
@@ -393,7 +393,7 @@ subcolor(struct colormap * cm, chr c)
393393
*/
394394
staticcolor
395395
newsub(structcolormap*cm,
396-
pcolorco)
396+
colorco)
397397
{
398398
colorsco;/* new subcolor */
399399

@@ -658,7 +658,7 @@ static void
658658
rainbow(structnfa*nfa,
659659
structcolormap*cm,
660660
inttype,
661-
pcolorbut,/* COLORLESS if no exceptions */
661+
colorbut,/* COLORLESS if no exceptions */
662662
structstate*from,
663663
structstate*to)
664664
{

‎src/backend/regex/regc_nfa.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ destroystate(struct nfa * nfa,
275275
staticvoid
276276
newarc(structnfa*nfa,
277277
intt,
278-
pcolorco,
278+
colorco,
279279
structstate*from,
280280
structstate*to)
281281
{
@@ -321,7 +321,7 @@ newarc(struct nfa * nfa,
321321
staticvoid
322322
createarc(structnfa*nfa,
323323
intt,
324-
pcolorco,
324+
colorco,
325325
structstate*from,
326326
structstate*to)
327327
{
@@ -334,7 +334,7 @@ createarc(struct nfa * nfa,
334334
assert(a!=NULL);
335335

336336
a->type=t;
337-
a->co=(color)co;
337+
a->co=co;
338338
a->to=to;
339339
a->from=from;
340340

@@ -553,7 +553,7 @@ hasnonemptyout(struct state * s)
553553
staticstructarc*
554554
findarc(structstate*s,
555555
inttype,
556-
pcolorco)
556+
colorco)
557557
{
558558
structarc*a;
559559

‎src/backend/regex/regcomp.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,19 @@ static chrchrnamed(struct vars *, const chr *, const chr *, chr);
9797
staticvoidinitcm(structvars*,structcolormap*);
9898
staticvoidfreecm(structcolormap*);
9999
staticvoidcmtreefree(structcolormap*,uniontree*,int);
100-
staticcolorsetcolor(structcolormap*,chr,pcolor);
100+
staticcolorsetcolor(structcolormap*,chr,color);
101101
staticcolormaxcolor(structcolormap*);
102102
staticcolornewcolor(structcolormap*);
103-
staticvoidfreecolor(structcolormap*,pcolor);
103+
staticvoidfreecolor(structcolormap*,color);
104104
staticcolorpseudocolor(structcolormap*);
105105
staticcolorsubcolor(structcolormap*,chrc);
106-
staticcolornewsub(structcolormap*,pcolor);
106+
staticcolornewsub(structcolormap*,color);
107107
staticvoidsubrange(structvars*,chr,chr,structstate*,structstate*);
108108
staticvoidsubblock(structvars*,chr,structstate*,structstate*);
109109
staticvoidokcolors(structnfa*,structcolormap*);
110110
staticvoidcolorchain(structcolormap*,structarc*);
111111
staticvoiduncolorchain(structcolormap*,structarc*);
112-
staticvoidrainbow(structnfa*,structcolormap*,int,pcolor,structstate*,structstate*);
112+
staticvoidrainbow(structnfa*,structcolormap*,int,color,structstate*,structstate*);
113113
staticvoidcolorcomplement(structnfa*,structcolormap*,int,structstate*,structstate*,structstate*);
114114

115115
#ifdefREG_DEBUG
@@ -125,13 +125,13 @@ static struct state *newfstate(struct nfa *, int flag);
125125
staticvoiddropstate(structnfa*,structstate*);
126126
staticvoidfreestate(structnfa*,structstate*);
127127
staticvoiddestroystate(structnfa*,structstate*);
128-
staticvoidnewarc(structnfa*,int,pcolor,structstate*,structstate*);
129-
staticvoidcreatearc(structnfa*,int,pcolor,structstate*,structstate*);
128+
staticvoidnewarc(structnfa*,int,color,structstate*,structstate*);
129+
staticvoidcreatearc(structnfa*,int,color,structstate*,structstate*);
130130
staticstructarc*allocarc(structnfa*,structstate*);
131131
staticvoidfreearc(structnfa*,structarc*);
132132
staticvoidchangearctarget(structarc*,structstate*);
133133
staticinthasnonemptyout(structstate*);
134-
staticstructarc*findarc(structstate*,int,pcolor);
134+
staticstructarc*findarc(structstate*,int,color);
135135
staticvoidcparc(structnfa*,structarc*,structstate*,structstate*);
136136
staticvoidsortins(structnfa*,structstate*);
137137
staticintsortins_cmp(constvoid*,constvoid*);

‎src/backend/regex/rege_dfa.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ static struct sset *
603603
miss(structvars*v,
604604
structdfa*d,
605605
structsset*css,
606-
pcolorco,
606+
colorco,
607607
chr*cp,/* next chr */
608608
chr*start)/* where the attempt got started */
609609
{
@@ -731,7 +731,7 @@ miss(struct vars * v,
731731
css->outs[co]=p;
732732
css->inchain[co]=p->ins;
733733
p->ins.ss=css;
734-
p->ins.co=(color)co;
734+
p->ins.co=co;
735735
}
736736
returnp;
737737
}
@@ -743,7 +743,7 @@ static int/* predicate: constraint satisfied? */
743743
lacon(structvars*v,
744744
structcnfa*pcnfa,/* parent cnfa */
745745
chr*cp,
746-
pcolorco)/* "color" of the lookaround constraint */
746+
colorco)/* "color" of the lookaround constraint */
747747
{
748748
intn;
749749
structsubre*sub;

‎src/backend/regex/regexec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ static struct dfa *newdfa(struct vars *, struct cnfa *, struct colormap *, struc
159159
staticvoidfreedfa(structdfa*);
160160
staticunsignedhash(unsigned*,int);
161161
staticstructsset*initialize(structvars*,structdfa*,chr*);
162-
staticstructsset*miss(structvars*,structdfa*,structsset*,pcolor,chr*,chr*);
163-
staticintlacon(structvars*,structcnfa*,chr*,pcolor);
162+
staticstructsset*miss(structvars*,structdfa*,structsset*,color,chr*,chr*);
163+
staticintlacon(structvars*,structcnfa*,chr*,color);
164164
staticstructsset*getvacant(structvars*,structdfa*,chr*,chr*);
165165
staticstructsset*pickss(structvars*,structdfa*,chr*,chr*);
166166

‎src/include/regex/regguts.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
* which are of much more manageable number.
150150
*/
151151
typedefshortcolor;/* colors of characters */
152-
typedefintpcolor;/* what color promotes to */
153152

154153
#defineMAX_COLOR32767/* max color (must fit in 'color' datatype) */
155154
#defineCOLORLESS(-1)/* impossible color */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp