File tree 1 file changed +5
-17
lines changed 1 file changed +5
-17
lines changed Original file line number Diff line number Diff line change @@ -967,6 +967,8 @@ internal_size(int *a, int len)
967
967
return size ;
968
968
}
969
969
970
+ #define UNIX_UNIQ (a ) a = _int_unique(a)
971
+
970
972
/* r is sorted and size of r > 1 */
971
973
static ArrayType *
972
974
_int_unique (ArrayType * r )
@@ -976,6 +978,9 @@ _int_unique(ArrayType *r)
976
978
* data ;
977
979
int num = ARRNELEMS (r );
978
980
981
+ if ( num < 2 )
982
+ return r ;
983
+
979
984
data = tmp = dr = ARRPTR (r );
980
985
while (tmp - data < num )
981
986
if (* tmp != * dr )
@@ -2445,23 +2450,6 @@ if (ARRNELEMS(a) > 1) \
2445
2450
qsort((void*)ARRPTR(a), ARRNELEMS(a),sizeof(int4), \
2446
2451
(direction) ? compASC : compDESC )
2447
2452
2448
- #define UNIX_UNIQ (a ) a = resize_intArrayType(a, unix_uniq(ARRPTR(a), ARRNELEMS(a)))
2449
-
2450
- static int32
2451
- unix_uniq (int32 * array , int32 count )
2452
- {
2453
- register int32 i ,
2454
- k = 0 ;
2455
-
2456
- for (i = 1 ; i < count ; i ++ )
2457
- if (array [k ] != array [i ])
2458
- {
2459
- k ++ ;
2460
- if (i > k )
2461
- array [k ] = array [i ];
2462
- }
2463
- return (k + 1 );
2464
- }
2465
2453
2466
2454
Datum
2467
2455
intset (PG_FUNCTION_ARGS )
You can’t perform that action at this time.
0 commit comments