diff options
author | Bruce Momjian <bruce@momjian.us> | 2006-10-04 00:30:14 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2006-10-04 00:30:14 +0000 |
commit | f99a569a2ee3763b4ae174e81250c95ca0fdcbb6 (patch) | |
tree | 76e6371fe8b347c73d7020c0bc54b9fba519dc10 /src/backend/access/gin/ginarrayproc.c | |
parent | 451e419e9852cdf9d7e7cefc09d5355abb3405e9 (diff) | |
download | postgresql-f99a569a2ee3763b4ae174e81250c95ca0fdcbb6.tar.gz postgresql-f99a569a2ee3763b4ae174e81250c95ca0fdcbb6.zip |
pgindent run for 8.2.
Diffstat (limited to 'src/backend/access/gin/ginarrayproc.c')
-rw-r--r-- | src/backend/access/gin/ginarrayproc.c | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/src/backend/access/gin/ginarrayproc.c b/src/backend/access/gin/ginarrayproc.c index 911cf629832..33a8b44a14d 100644 --- a/src/backend/access/gin/ginarrayproc.c +++ b/src/backend/access/gin/ginarrayproc.c @@ -1,14 +1,14 @@ /*------------------------------------------------------------------------- * * ginarrayproc.c - * support functions for GIN's indexing of any array + * support functions for GIN's indexing of any array * * * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.5 2006/09/10 20:14:20 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.6 2006/10/04 00:29:47 momjian Exp $ *------------------------------------------------------------------------- */ #include "postgres.h" @@ -23,64 +23,73 @@ #define GinContainedStrategy 3 #define GinEqualStrategy 4 -#define ARRAYCHECK(x) do { \ +#define ARRAYCHECK(x) do { \ if ( ARR_HASNULL(x) ) \ - ereport(ERROR, \ - (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), \ - errmsg("array must not contain nulls"))); \ -} while(0) + ereport(ERROR, \ + (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), \ + errmsg("array must not contain nulls"))); \ +} while(0) /* * Function used as extractValue and extractQuery both */ Datum -ginarrayextract(PG_FUNCTION_ARGS) { - ArrayType *array; - uint32 *nentries = (uint32*)PG_GETARG_POINTER(1); - Datum *entries = NULL; - int16 elmlen; - bool elmbyval; - char elmalign; +ginarrayextract(PG_FUNCTION_ARGS) +{ + ArrayType *array; + uint32 *nentries = (uint32 *) PG_GETARG_POINTER(1); + Datum *entries = NULL; + int16 elmlen; + bool elmbyval; + char elmalign; - /* we should guarantee that array will not be destroyed during all operation */ + /* + * we should guarantee that array will not be destroyed during all + * operation + */ array = PG_GETARG_ARRAYTYPE_P_COPY(0); ARRAYCHECK(array); get_typlenbyvalalign(ARR_ELEMTYPE(array), - &elmlen, &elmbyval, &elmalign); + &elmlen, &elmbyval, &elmalign); deconstruct_array(array, - ARR_ELEMTYPE(array), - elmlen, elmbyval, elmalign, - &entries, NULL, (int*)nentries); + ARR_ELEMTYPE(array), + elmlen, elmbyval, elmalign, + &entries, NULL, (int *) nentries); /* we should not free array, entries[i] points into it */ PG_RETURN_POINTER(entries); } Datum -ginarrayconsistent(PG_FUNCTION_ARGS) { - bool *check = (bool*)PG_GETARG_POINTER(0); - StrategyNumber strategy = PG_GETARG_UINT16(1); - ArrayType *query = PG_GETARG_ARRAYTYPE_P(2); - int res, i, nentries; +ginarrayconsistent(PG_FUNCTION_ARGS) +{ + bool *check = (bool *) PG_GETARG_POINTER(0); + StrategyNumber strategy = PG_GETARG_UINT16(1); + ArrayType *query = PG_GETARG_ARRAYTYPE_P(2); + int res, + i, + nentries; /* ARRAYCHECK was already done by previous ginarrayextract call */ - switch( strategy ) { + switch (strategy) + { case GinOverlapStrategy: case GinContainedStrategy: - /* at least one element in check[] is true, so result = true */ + /* at least one element in check[] is true, so result = true */ res = TRUE; break; case GinContainsStrategy: case GinEqualStrategy: - nentries=ArrayGetNItems(ARR_NDIM(query), ARR_DIMS(query)); + nentries = ArrayGetNItems(ARR_NDIM(query), ARR_DIMS(query)); res = TRUE; - for(i=0;i<nentries;i++) - if ( !check[i] ) { + for (i = 0; i < nentries; i++) + if (!check[i]) + { res = FALSE; break; } |