mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
pgindent run.
This commit is contained in:
@ -91,19 +91,19 @@ typedef char *BITVECP;
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int4 len;
|
||||
int4 flag;
|
||||
char data[1];
|
||||
} GISTTYPE;
|
||||
int4 len;
|
||||
int4 flag;
|
||||
char data[1];
|
||||
} GISTTYPE;
|
||||
|
||||
#define ALLISTRUE 0x04
|
||||
#define ALLISTRUE 0x04
|
||||
|
||||
#define ISALLTRUE(x) ( ((GISTTYPE*)x)->flag & ALLISTRUE )
|
||||
#define ISALLTRUE(x) ( ((GISTTYPE*)x)->flag & ALLISTRUE )
|
||||
|
||||
#define GTHDRSIZE ( sizeof(int4)*2 )
|
||||
#define GTHDRSIZE ( sizeof(int4)*2 )
|
||||
#define CALCGTSIZE(flag) ( GTHDRSIZE+(((flag) & ALLISTRUE) ? 0 : SIGLEN) )
|
||||
|
||||
#define GETSIGN(x) ( (BITVECP)( (char*)x+GTHDRSIZE ) )
|
||||
#define GETSIGN(x) ( (BITVECP)( (char*)x+GTHDRSIZE ) )
|
||||
|
||||
/*
|
||||
** types for functions
|
||||
@ -114,22 +114,22 @@ typedef void (*formfloat) (ArrayType *, float *);
|
||||
/*
|
||||
** useful function
|
||||
*/
|
||||
bool isort(int4 *a, const int len);
|
||||
ArrayType *new_intArrayType(int num);
|
||||
ArrayType *copy_intArrayType(ArrayType *a);
|
||||
ArrayType *resize_intArrayType(ArrayType *a, int num);
|
||||
int internal_size(int *a, int len);
|
||||
ArrayType *_int_unique(ArrayType *a);
|
||||
int32 intarray_match_first(ArrayType *a, int32 elem);
|
||||
ArrayType *intarray_add_elem(ArrayType *a, int32 elem);
|
||||
ArrayType *intarray_concat_arrays(ArrayType *a, ArrayType *b);
|
||||
ArrayType *int_to_intset(int32 elem);
|
||||
bool inner_int_overlap(ArrayType *a, ArrayType *b);
|
||||
bool inner_int_contains(ArrayType *a, ArrayType *b);
|
||||
ArrayType * inner_int_union(ArrayType *a, ArrayType *b);
|
||||
ArrayType * inner_int_inter(ArrayType *a, ArrayType *b);
|
||||
void rt__int_size(ArrayType *a, float *size);
|
||||
void gensign(BITVEC sign, int *a, int len);
|
||||
bool isort(int4 *a, const int len);
|
||||
ArrayType *new_intArrayType(int num);
|
||||
ArrayType *copy_intArrayType(ArrayType *a);
|
||||
ArrayType *resize_intArrayType(ArrayType *a, int num);
|
||||
int internal_size(int *a, int len);
|
||||
ArrayType *_int_unique(ArrayType *a);
|
||||
int32 intarray_match_first(ArrayType *a, int32 elem);
|
||||
ArrayType *intarray_add_elem(ArrayType *a, int32 elem);
|
||||
ArrayType *intarray_concat_arrays(ArrayType *a, ArrayType *b);
|
||||
ArrayType *int_to_intset(int32 elem);
|
||||
bool inner_int_overlap(ArrayType *a, ArrayType *b);
|
||||
bool inner_int_contains(ArrayType *a, ArrayType *b);
|
||||
ArrayType *inner_int_union(ArrayType *a, ArrayType *b);
|
||||
ArrayType *inner_int_inter(ArrayType *a, ArrayType *b);
|
||||
void rt__int_size(ArrayType *a, float *size);
|
||||
void gensign(BITVEC sign, int *a, int len);
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
@ -160,18 +160,16 @@ typedef struct
|
||||
#define COMPUTESIZE(size) ( HDRSIZEQT + size * sizeof(ITEM) )
|
||||
#define GETQUERY(x) (ITEM*)( (char*)(x)+HDRSIZEQT )
|
||||
|
||||
bool signconsistent(QUERYTYPE * query, BITVEC sign, bool calcnot);
|
||||
bool execconsistent(QUERYTYPE * query, ArrayType *array, bool calcnot);
|
||||
bool signconsistent(QUERYTYPE * query, BITVEC sign, bool calcnot);
|
||||
bool execconsistent(QUERYTYPE * query, ArrayType *array, bool calcnot);
|
||||
|
||||
|
||||
|
||||
int compASC(const void *a, const void *b);
|
||||
|
||||
int compDESC(const void *a, const void *b);
|
||||
|
||||
#define QSORT(a, direction) \
|
||||
if (ARRNELEMS(a) > 1) \
|
||||
qsort((void*)ARRPTR(a), ARRNELEMS(a),sizeof(int4), \
|
||||
(direction) ? compASC : compDESC )
|
||||
int compASC(const void *a, const void *b);
|
||||
|
||||
int compDESC(const void *a, const void *b);
|
||||
|
||||
#define QSORT(a, direction) \
|
||||
if (ARRNELEMS(a) > 1) \
|
||||
qsort((void*)ARRPTR(a), ARRNELEMS(a),sizeof(int4), \
|
||||
(direction) ? compASC : compDESC )
|
||||
|
@ -299,7 +299,7 @@ signconsistent(QUERYTYPE * query, BITVEC sign, bool calcnot)
|
||||
GETQUERY(query) + query->size - 1,
|
||||
(void *) sign, calcnot,
|
||||
checkcondition_bit
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -326,7 +326,7 @@ rboolop(PG_FUNCTION_ARGS)
|
||||
boolop,
|
||||
PG_GETARG_DATUM(1),
|
||||
PG_GETARG_DATUM(0)
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
Datum
|
||||
@ -743,4 +743,3 @@ querytree(PG_FUNCTION_ARGS)
|
||||
|
||||
PG_RETURN_POINTER(res);
|
||||
}
|
||||
|
||||
|
@ -85,27 +85,31 @@ g_int_consistent(PG_FUNCTION_ARGS)
|
||||
}
|
||||
|
||||
Datum
|
||||
g_int_union(PG_FUNCTION_ARGS) {
|
||||
bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
|
||||
int *size = (int *) PG_GETARG_POINTER(1);
|
||||
int4 i,len = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
|
||||
ArrayType *res;
|
||||
int totlen=0,*ptr;
|
||||
g_int_union(PG_FUNCTION_ARGS)
|
||||
{
|
||||
bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
|
||||
int *size = (int *) PG_GETARG_POINTER(1);
|
||||
int4 i,
|
||||
len = (VARSIZE(entryvec) - VARHDRSZ) / sizeof(GISTENTRY);
|
||||
ArrayType *res;
|
||||
int totlen = 0,
|
||||
*ptr;
|
||||
|
||||
for (i = 0; i < len; i++)
|
||||
totlen+=ARRNELEMS( GETENTRY(entryvec,i) );
|
||||
totlen += ARRNELEMS(GETENTRY(entryvec, i));
|
||||
|
||||
res=new_intArrayType(totlen);
|
||||
ptr=ARRPTR(res);
|
||||
res = new_intArrayType(totlen);
|
||||
ptr = ARRPTR(res);
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
memcpy(ptr, ARRPTR( GETENTRY(entryvec,i) ), ARRNELEMS( GETENTRY(entryvec,i) )*sizeof(int4) );
|
||||
ptr+=ARRNELEMS( GETENTRY(entryvec,i) );
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
memcpy(ptr, ARRPTR(GETENTRY(entryvec, i)), ARRNELEMS(GETENTRY(entryvec, i)) * sizeof(int4));
|
||||
ptr += ARRNELEMS(GETENTRY(entryvec, i));
|
||||
}
|
||||
|
||||
QSORT(res,1);
|
||||
res=_int_unique(res);
|
||||
*size = VARSIZE(res);
|
||||
QSORT(res, 1);
|
||||
res = _int_unique(res);
|
||||
*size = VARSIZE(res);
|
||||
PG_RETURN_POINTER(res);
|
||||
}
|
||||
|
||||
@ -239,22 +243,23 @@ g_int_decompress(PG_FUNCTION_ARGS)
|
||||
** The GiST Penalty method for _intments
|
||||
*/
|
||||
Datum
|
||||
g_int_penalty(PG_FUNCTION_ARGS) {
|
||||
GISTENTRY *origentry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GISTENTRY *newentry = (GISTENTRY *) PG_GETARG_POINTER(1);
|
||||
float *result = (float *) PG_GETARG_POINTER(2);
|
||||
g_int_penalty(PG_FUNCTION_ARGS)
|
||||
{
|
||||
GISTENTRY *origentry = (GISTENTRY *) PG_GETARG_POINTER(0);
|
||||
GISTENTRY *newentry = (GISTENTRY *) PG_GETARG_POINTER(1);
|
||||
float *result = (float *) PG_GETARG_POINTER(2);
|
||||
ArrayType *ud;
|
||||
float tmp1,
|
||||
tmp2;
|
||||
|
||||
ud = inner_int_union((ArrayType *) DatumGetPointer(origentry->key),
|
||||
(ArrayType *) DatumGetPointer(newentry->key));
|
||||
(ArrayType *) DatumGetPointer(newentry->key));
|
||||
rt__int_size(ud, &tmp1);
|
||||
rt__int_size((ArrayType *) DatumGetPointer(origentry->key), &tmp2);
|
||||
*result = tmp1 - tmp2;
|
||||
pfree(ud);
|
||||
|
||||
PG_RETURN_POINTER (result);
|
||||
PG_RETURN_POINTER(result);
|
||||
}
|
||||
|
||||
|
||||
@ -311,8 +316,9 @@ comparecost(const void *a, const void *b)
|
||||
** We use Guttman's poly time split algorithm
|
||||
*/
|
||||
Datum
|
||||
g_int_picksplit(PG_FUNCTION_ARGS) {
|
||||
bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
|
||||
g_int_picksplit(PG_FUNCTION_ARGS)
|
||||
{
|
||||
bytea *entryvec = (bytea *) PG_GETARG_POINTER(0);
|
||||
GIST_SPLITVEC *v = (GIST_SPLITVEC *) PG_GETARG_POINTER(1);
|
||||
OffsetNumber i,
|
||||
j;
|
||||
@ -501,4 +507,3 @@ g_int_picksplit(PG_FUNCTION_ARGS) {
|
||||
|
||||
PG_RETURN_POINTER(v);
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ _int_unique(ArrayType *r)
|
||||
*data;
|
||||
int num = ARRNELEMS(r);
|
||||
|
||||
if ( num<2 )
|
||||
if (num < 2)
|
||||
return r;
|
||||
|
||||
data = tmp = dr = ARRPTR(r);
|
||||
@ -367,4 +367,3 @@ compDESC(const void *a, const void *b)
|
||||
return 0;
|
||||
return (*(int4 *) a < *(int4 *) b) ? 1 : -1;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user