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

Commit4f09b55

Browse files
committed
Simplify overly-cute array coding to avoid an apparent gcc bug, which
may or may not be harmless. Report from Stefan, patch from Heikki.
1 parent4bbb7f9 commit4f09b55

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

‎contrib/pg_trgm/trgm_op.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -194,19 +194,18 @@ show_trgm(PG_FUNCTION_ARGS)
194194
Datum*d;
195195
ArrayType*a;
196196
trgm*ptr;
197+
inti;
197198

198199
trg=generate_trgm(VARDATA(in),VARSIZE(in)-VARHDRSZ);
199200
d= (Datum*)palloc(sizeof(Datum)* (1+ARRNELEM(trg)));
200201

201-
ptr=GETARR(trg);
202-
while (ptr-GETARR(trg)<ARRNELEM(trg))
202+
for (i=0,ptr=GETARR(trg);i<ARRNELEM(trg);i++,ptr++)
203203
{
204204
text*item= (text*)palloc(VARHDRSZ+3);
205205

206206
SET_VARSIZE(item,VARHDRSZ+3);
207207
CPTRGM(VARDATA(item),ptr);
208-
d[ptr-GETARR(trg)]=PointerGetDatum(item);
209-
ptr++;
208+
d[i]=PointerGetDatum(item);
210209
}
211210

212211
a=construct_array(
@@ -218,12 +217,8 @@ show_trgm(PG_FUNCTION_ARGS)
218217
'i'
219218
);
220219

221-
ptr=GETARR(trg);
222-
while (ptr-GETARR(trg)<ARRNELEM(trg))
223-
{
224-
pfree(DatumGetPointer(d[ptr-GETARR(trg)]));
225-
ptr++;
226-
}
220+
for (i=0;i<ARRNELEM(trg);i++)
221+
pfree(DatumGetPointer(d[i]));
227222

228223
pfree(d);
229224
pfree(trg);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp