File tree 1 file changed +5
-10
lines changed
1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -194,19 +194,18 @@ show_trgm(PG_FUNCTION_ARGS)
194
194
Datum * d ;
195
195
ArrayType * a ;
196
196
trgm * ptr ;
197
+ int i ;
197
198
198
199
trg = generate_trgm (VARDATA (in ), VARSIZE (in ) - VARHDRSZ );
199
200
d = (Datum * ) palloc (sizeof (Datum ) * (1 + ARRNELEM (trg )));
200
201
201
- ptr = GETARR (trg );
202
- while (ptr - GETARR (trg ) < ARRNELEM (trg ))
202
+ for (i = 0 , ptr = GETARR (trg ); i < ARRNELEM (trg ); i ++ , ptr ++ )
203
203
{
204
204
text * item = (text * ) palloc (VARHDRSZ + 3 );
205
205
206
206
SET_VARSIZE (item , VARHDRSZ + 3 );
207
207
CPTRGM (VARDATA (item ), ptr );
208
- d [ptr - GETARR (trg )] = PointerGetDatum (item );
209
- ptr ++ ;
208
+ d [i ] = PointerGetDatum (item );
210
209
}
211
210
212
211
a = construct_array (
@@ -218,12 +217,8 @@ show_trgm(PG_FUNCTION_ARGS)
218
217
'i'
219
218
);
220
219
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 ]));
227
222
228
223
pfree (d );
229
224
pfree (trg );
You can’t perform that action at this time.
0 commit comments