aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r--src/backend/utils/adt/arrayfuncs.c109
-rw-r--r--src/backend/utils/adt/arrayutils.c7
-rw-r--r--src/backend/utils/adt/datetime.c18
-rw-r--r--src/backend/utils/adt/formatting.c15
-rw-r--r--src/backend/utils/adt/geo_selfuncs.c4
-rw-r--r--src/backend/utils/adt/numeric.c40
-rw-r--r--src/backend/utils/adt/oid.c10
-rw-r--r--src/backend/utils/adt/pg_lzcompress.c8
-rw-r--r--src/backend/utils/adt/regexp.c8
-rw-r--r--src/backend/utils/adt/ri_triggers.c26
-rw-r--r--src/backend/utils/adt/ruleutils.c10
-rw-r--r--src/backend/utils/adt/selfuncs.c54
-rw-r--r--src/backend/utils/adt/timestamp.c43
-rw-r--r--src/backend/utils/adt/varlena.c28
14 files changed, 189 insertions, 191 deletions
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index ec7009816b8..1b8274ba982 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.125 2005/11/19 19:44:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.126 2005/11/22 18:17:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,7 +34,7 @@
/*
* GUC parameter
*/
-bool Array_nulls = true;
+bool Array_nulls = true;
/*
* Local definitions
@@ -68,9 +68,9 @@ static void ReadArrayBinary(StringInfo buf, int nitems,
Datum *values, bool *nulls,
bool *hasnulls, int32 *nbytes);
static void CopyArrayEls(ArrayType *array,
- Datum *values, bool *nulls, int nitems,
- int typlen, bool typbyval, char typalign,
- bool freedata);
+ Datum *values, bool *nulls, int nitems,
+ int typlen, bool typbyval, char typalign,
+ bool freedata);
static bool array_get_isnull(const bits8 *nullbitmap, int offset);
static void array_set_isnull(bits8 *nullbitmap, int offset, bool isNull);
static Datum ArrayCast(char *value, bool byval, int len);
@@ -78,26 +78,26 @@ static int ArrayCastAndSet(Datum src,
int typlen, bool typbyval, char typalign,
char *dest);
static char *array_seek(char *ptr, int offset, bits8 *nullbitmap, int nitems,
- int typlen, bool typbyval, char typalign);
-static int array_nelems_size(char *ptr, int offset, bits8 *nullbitmap,
- int nitems, int typlen, bool typbyval, char typalign);
-static int array_copy(char *destptr, int nitems,
- char *srcptr, int offset, bits8 *nullbitmap,
- int typlen, bool typbyval, char typalign);
+ int typlen, bool typbyval, char typalign);
+static int array_nelems_size(char *ptr, int offset, bits8 *nullbitmap,
+ int nitems, int typlen, bool typbyval, char typalign);
+static int array_copy(char *destptr, int nitems,
+ char *srcptr, int offset, bits8 *nullbitmap,
+ int typlen, bool typbyval, char typalign);
static int array_slice_size(char *arraydataptr, bits8 *arraynullsptr,
- int ndim, int *dim, int *lb,
- int *st, int *endp,
- int typlen, bool typbyval, char typalign);
+ int ndim, int *dim, int *lb,
+ int *st, int *endp,
+ int typlen, bool typbyval, char typalign);
static void array_extract_slice(ArrayType *newarray,
- int ndim, int *dim, int *lb,
- char *arraydataptr, bits8 *arraynullsptr,
- int *st, int *endp,
- int typlen, bool typbyval, char typalign);
+ int ndim, int *dim, int *lb,
+ char *arraydataptr, bits8 *arraynullsptr,
+ int *st, int *endp,
+ int typlen, bool typbyval, char typalign);
static void array_insert_slice(ArrayType *destArray, ArrayType *origArray,
- ArrayType *srcArray,
- int ndim, int *dim, int *lb,
- int *st, int *endp,
- int typlen, bool typbyval, char typalign);
+ ArrayType *srcArray,
+ int ndim, int *dim, int *lb,
+ int *st, int *endp,
+ int typlen, bool typbyval, char typalign);
static int array_cmp(FunctionCallInfo fcinfo);
static Datum array_type_length_coerce_internal(ArrayType *src,
int32 desttypmod,
@@ -181,8 +181,8 @@ array_in(PG_FUNCTION_ARGS)
* Otherwise, we require the input to be in curly-brace style, and we
* prescan the input to determine dimensions.
*
- * Dimension info takes the form of one or more [n] or [m:n] items.
- * The outer loop iterates once per dimension item.
+ * Dimension info takes the form of one or more [n] or [m:n] items. The
+ * outer loop iterates once per dimension item.
*/
p = string_save;
ndim = 0;
@@ -644,9 +644,9 @@ ReadArrayStr(char *arrayStr,
* in-place within arrayStr to do this. srcptr is the current scan point,
* and dstptr is where we are copying to.
*
- * We also want to suppress leading and trailing unquoted whitespace.
- * We use the leadingspace flag to suppress leading space. Trailing space
- * is tracked by using dstendptr to point to the last significant output
+ * We also want to suppress leading and trailing unquoted whitespace. We
+ * use the leadingspace flag to suppress leading space. Trailing space is
+ * tracked by using dstendptr to point to the last significant output
* character.
*
* The error checking in this routine is mostly pro-forma, since we expect
@@ -688,7 +688,7 @@ ReadArrayStr(char *arrayStr,
/* Treat the escaped character as non-whitespace */
leadingspace = false;
dstendptr = dstptr;
- hasquoting = true; /* can't be a NULL marker */
+ hasquoting = true; /* can't be a NULL marker */
break;
case '\"':
in_quotes = !in_quotes;
@@ -703,7 +703,7 @@ ReadArrayStr(char *arrayStr,
*/
dstendptr = dstptr;
}
- hasquoting = true; /* can't be a NULL marker */
+ hasquoting = true; /* can't be a NULL marker */
srcptr++;
break;
case '{':
@@ -783,7 +783,7 @@ ReadArrayStr(char *arrayStr,
errmsg("malformed array literal: \"%s\"",
origStr)));
- if (Array_nulls && !hasquoting &&
+ if (Array_nulls && !hasquoting &&
pg_strcasecmp(itemstart, "NULL") == 0)
{
/* it's a NULL item */
@@ -866,7 +866,7 @@ CopyArrayEls(ArrayType *array,
{
if (nulls && nulls[i])
{
- if (!bitmap) /* shouldn't happen */
+ if (!bitmap) /* shouldn't happen */
elog(ERROR, "null array element where not supported");
/* bitmap bit stays 0 */
}
@@ -912,6 +912,7 @@ array_out(PG_FUNCTION_ARGS)
*retval,
**values,
dims_str[(MAXDIM * 33) + 2];
+
/*
* 33 per dim since we assume 15 digits per number + ':' +'[]'
*
@@ -1024,9 +1025,9 @@ array_out(PG_FUNCTION_ARGS)
/* count data plus backslashes; detect chars needing quotes */
if (values[i][0] == '\0')
- needquote = true; /* force quotes for empty string */
+ needquote = true; /* force quotes for empty string */
else if (pg_strcasecmp(values[i], "NULL") == 0)
- needquote = true; /* force quotes for literal NULL */
+ needquote = true; /* force quotes for literal NULL */
else
needquote = false;
@@ -2158,12 +2159,12 @@ array_set(ArrayType *array,
/*
* Fill in nulls bitmap if needed
*
- * Note: it's possible we just replaced the last NULL with a non-NULL,
- * and could get rid of the bitmap. Seems not worth testing for though.
+ * Note: it's possible we just replaced the last NULL with a non-NULL, and
+ * could get rid of the bitmap. Seems not worth testing for though.
*/
if (newhasnulls)
{
- bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
+ bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
array_set_isnull(newnullbitmap, offset, isNull);
if (extendbefore)
@@ -2176,8 +2177,8 @@ array_set(ArrayType *array,
oldnullbitmap, 0,
offset);
if (!extendafter)
- array_bitmap_copy(newnullbitmap, offset+1,
- oldnullbitmap, offset+1,
+ array_bitmap_copy(newnullbitmap, offset + 1,
+ oldnullbitmap, offset + 1,
oldnitems - offset - 1);
}
}
@@ -2471,8 +2472,8 @@ array_set_slice(ArrayType *array,
/* fill in nulls bitmap if needed */
if (newhasnulls)
{
- bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
- bits8 *oldnullbitmap = ARR_NULLBITMAP(array);
+ bits8 *newnullbitmap = ARR_NULLBITMAP(newarray);
+ bits8 *oldnullbitmap = ARR_NULLBITMAP(array);
array_bitmap_copy(newnullbitmap, 0,
oldnullbitmap, 0,
@@ -2480,8 +2481,8 @@ array_set_slice(ArrayType *array,
array_bitmap_copy(newnullbitmap, itemsbefore,
ARR_NULLBITMAP(srcArray), 0,
nsrcitems);
- array_bitmap_copy(newnullbitmap, itemsbefore+nsrcitems,
- oldnullbitmap, itemsbefore+nolditems,
+ array_bitmap_copy(newnullbitmap, itemsbefore + nsrcitems,
+ oldnullbitmap, itemsbefore + nolditems,
itemsafter);
}
}
@@ -2632,7 +2633,7 @@ array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType,
*/
if (fcinfo->flinfo->fn_strict)
{
- int j;
+ int j;
for (j = 0; j < fcinfo->nargs; j++)
{
@@ -2922,7 +2923,7 @@ deconstruct_array(ArrayType *array,
else
ereport(ERROR,
(errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED),
- errmsg("NULL array element not allowed in this context")));
+ errmsg("NULL array element not allowed in this context")));
}
else
{
@@ -3319,10 +3320,10 @@ array_cmp(FunctionCallInfo fcinfo)
}
/*
- * If arrays contain same data (up to end of shorter one), apply additional
- * rules to sort by dimensionality. The relative significance of the
- * different bits of information is historical; mainly we just care that
- * we don't say "equal" for arrays of different dimensionality.
+ * If arrays contain same data (up to end of shorter one), apply
+ * additional rules to sort by dimensionality. The relative significance
+ * of the different bits of information is historical; mainly we just care
+ * that we don't say "equal" for arrays of different dimensionality.
*/
if (result == 0)
{
@@ -3545,7 +3546,7 @@ array_copy(char *destptr, int nitems,
*
* Note: this could certainly be optimized using standard bitblt methods.
* However, it's not clear that the typical Postgres array has enough elements
- * to make it worth worrying too much. For the moment, KISS.
+ * to make it worth worrying too much. For the moment, KISS.
*/
void
array_bitmap_copy(bits8 *destbitmap, int destoffset,
@@ -3706,7 +3707,7 @@ array_extract_slice(ArrayType *newarray,
src_offset = ArrayGetOffset(ndim, dim, lb, st);
srcdataptr = array_seek(arraydataptr, 0, arraynullsptr, src_offset,
- typlen, typbyval, typalign);
+ typlen, typbyval, typalign);
mda_get_prod(ndim, dim, prod);
mda_get_range(ndim, span, st, endp);
mda_get_offset_values(ndim, dist, prod, span);
@@ -3742,7 +3743,7 @@ array_extract_slice(ArrayType *newarray,
* Insert a slice into an array.
*
* ndim/dim[]/lb[] are dimensions of the original array. A new array with
- * those same dimensions is to be constructed. destArray must already
+ * those same dimensions is to be constructed. destArray must already
* have been allocated and its header initialized.
*
* st[]/endp[] identify the slice to be replaced. Elements within the slice
@@ -3969,8 +3970,8 @@ array_type_length_coerce_internal(ArrayType *src,
/*
* Use array_map to apply the function to each array element.
*
- * We pass on the desttypmod and isExplicit flags whether or not the function
- * wants them.
+ * We pass on the desttypmod and isExplicit flags whether or not the
+ * function wants them.
*/
InitFunctionCallInfoData(locfcinfo, &my_extra->coerce_finfo, 3,
NULL, NULL);
@@ -4112,7 +4113,7 @@ accumArrayResult(ArrayBuildState *astate,
(astate->nelems + ARRAY_ELEMS_CHUNKSIZE) * sizeof(Datum));
astate->dnulls = (bool *)
repalloc(astate->dnulls,
- (astate->nelems + ARRAY_ELEMS_CHUNKSIZE) * sizeof(bool));
+ (astate->nelems + ARRAY_ELEMS_CHUNKSIZE) * sizeof(bool));
}
}
diff --git a/src/backend/utils/adt/arrayutils.c b/src/backend/utils/adt/arrayutils.c
index c7355968d78..aab0639a6d4 100644
--- a/src/backend/utils/adt/arrayutils.c
+++ b/src/backend/utils/adt/arrayutils.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/arrayutils.c,v 1.19 2005/11/17 22:14:52 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/arrayutils.c,v 1.20 2005/11/22 18:17:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -82,7 +82,7 @@ ArrayGetNItems(int ndim, const int *dims)
ret = 1;
for (i = 0; i < ndim; i++)
{
- int64 prod;
+ int64 prod;
/* A negative dimension implies that UB-LB overflowed ... */
if (dims[i] < 0)
@@ -91,7 +91,8 @@ ArrayGetNItems(int ndim, const int *dims)
errmsg("array size exceeds the maximum allowed (%d)",
(int) MaxArraySize)));
- prod = (int64) ret * (int64) dims[i];
+ prod = (int64) ret *(int64) dims[i];
+
ret = (int32) prod;
if ((int64) ret != prod)
ereport(ERROR,
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 5b3fc46d9c2..5fc8b2be3b9 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.160 2005/10/15 02:49:28 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.161 2005/11/22 18:17:22 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3550,8 +3550,8 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
@@ -3602,8 +3602,8 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
@@ -3650,8 +3650,8 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
@@ -3706,8 +3706,8 @@ EncodeDateTime(struct pg_tm * tm, fsec_t fsec, int *tzp, char **tzn, int style,
* Print fractional seconds if any. The field widths here should
* be at least equal to MAX_TIMESTAMP_PRECISION.
*
- * In float mode, don't print fractional seconds before 1 AD, since
- * it's unlikely there's any precision left ...
+ * In float mode, don't print fractional seconds before 1 AD,
+ * since it's unlikely there's any precision left ...
*/
#ifdef HAVE_INT64_TIMESTAMP
if (fsec != 0)
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index de84afe42c9..224f3e5b3db 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1,7 +1,7 @@
/* -----------------------------------------------------------------------
* formatting.c
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.101 2005/10/20 15:59:46 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.102 2005/11/22 18:17:22 momjian Exp $
*
*
* Portions Copyright (c) 1999-2005, PostgreSQL Global Development Group
@@ -1326,8 +1326,8 @@ DCH_processor(FormatNode *node, char *inout, bool is_to_char,
* The input string is shorter than format picture, so it's good
* time to break this loop...
*
- * Note: this isn't relevant for TO_CHAR mode, beacuse it use 'inout'
- * allocated by format picture length.
+ * Note: this isn't relevant for TO_CHAR mode, beacuse it use
+ * 'inout' allocated by format picture length.
*/
break;
@@ -3752,8 +3752,8 @@ NUM_numpart_from_char(NUMProc *Np, int id, int plen)
* We need sign detection because determine exact position of post-sign is
* difficult:
*
- * FM9999.9999999S -> 123.001- 9.9S -> .5- FM9.999999MI
- * -> 5.01-
+ * FM9999.9999999S -> 123.001- 9.9S -> .5- FM9.999999MI ->
+ * 5.01-
*/
if (*Np->number == ' ' && Np->read_pre + Np->read_post > 0)
{
@@ -3797,8 +3797,9 @@ NUM_numpart_from_char(NUMProc *Np, int id, int plen)
*
* FM9.999999MI -> 5.01-
*
- * if (.... && IS_LSIGN(Np->Num)==FALSE) prevents read wrong formats like
- * to_number('1 -', '9S') where sign is not anchored to last number.
+ * if (.... && IS_LSIGN(Np->Num)==FALSE) prevents read wrong formats
+ * like to_number('1 -', '9S') where sign is not anchored to last
+ * number.
*/
else if (isread == FALSE && IS_LSIGN(Np->Num) == FALSE &&
(IS_PLUS(Np->Num) || IS_MINUS(Np->Num)))
diff --git a/src/backend/utils/adt/geo_selfuncs.c b/src/backend/utils/adt/geo_selfuncs.c
index 9aa33831379..449d05a6a0c 100644
--- a/src/backend/utils/adt/geo_selfuncs.c
+++ b/src/backend/utils/adt/geo_selfuncs.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.25 2005/11/07 17:36:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.26 2005/11/22 18:17:23 momjian Exp $
*
* XXX These are totally bogus. Perhaps someone will make them do
* something reasonable, someday.
@@ -22,7 +22,7 @@
/*
- * Selectivity functions for geometric operators. These are bogus -- unless
+ * Selectivity functions for geometric operators. These are bogus -- unless
* we know the actual key distribution in the index, we can't make a good
* prediction of the selectivity of these operators.
*
diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c
index 8a69a936dc1..fb2e16ee53f 100644
--- a/src/backend/utils/adt/numeric.c
+++ b/src/backend/utils/adt/numeric.c
@@ -14,7 +14,7 @@
* Copyright (c) 1998-2005, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.87 2005/11/17 22:14:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/numeric.c,v 1.88 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -348,8 +348,8 @@ numeric_out(PG_FUNCTION_ARGS)
/*
* Get the number in the variable format.
*
- * Even if we didn't need to change format, we'd still need to copy the value
- * to have a modifiable copy for rounding. set_var_from_num() also
+ * Even if we didn't need to change format, we'd still need to copy the
+ * value to have a modifiable copy for rounding. set_var_from_num() also
* guarantees there is extra digit space in case we produce a carry out
* from rounding.
*/
@@ -459,7 +459,7 @@ numeric_send(PG_FUNCTION_ARGS)
* scale of the attribute have to be applied on the value.
*/
Datum
-numeric(PG_FUNCTION_ARGS)
+numeric (PG_FUNCTION_ARGS)
{
Numeric num = PG_GETARG_NUMERIC(0);
int32 typmod = PG_GETARG_INT32(1);
@@ -2961,10 +2961,10 @@ get_str_from_var(NumericVar *var, int dscale)
/*
* Allocate space for the result.
*
- * i is set to to # of decimal digits before decimal point. dscale is the #
- * of decimal digits we will print after decimal point. We may generate as
- * many as DEC_DIGITS-1 excess digits at the end, and in addition we need
- * room for sign, decimal point, null terminator.
+ * i is set to to # of decimal digits before decimal point. dscale is the
+ * # of decimal digits we will print after decimal point. We may generate
+ * as many as DEC_DIGITS-1 excess digits at the end, and in addition we
+ * need room for sign, decimal point, null terminator.
*/
i = (var->weight + 1) * DEC_DIGITS;
if (i <= 0)
@@ -3901,12 +3901,12 @@ div_var(NumericVar *var1, NumericVar *var2, NumericVar *result,
* INT_MAX is noticeably larger than NBASE*NBASE, this gives us headroom
* to avoid normalizing carries immediately.
*
- * We start with div[] containing one zero digit followed by the dividend's
- * digits (plus appended zeroes to reach the desired precision including
- * guard digits). Each step of the main loop computes an (approximate)
- * quotient digit and stores it into div[], removing one position of
- * dividend space. A final pass of carry propagation takes care of any
- * mistaken quotient digits.
+ * We start with div[] containing one zero digit followed by the
+ * dividend's digits (plus appended zeroes to reach the desired precision
+ * including guard digits). Each step of the main loop computes an
+ * (approximate) quotient digit and stores it into div[], removing one
+ * position of dividend space. A final pass of carry propagation takes
+ * care of any mistaken quotient digits.
*/
div = (int *) palloc0((div_ndigits + 1) * sizeof(int));
for (i = 0; i < var1ndigits; i++)
@@ -4433,8 +4433,8 @@ exp_var_internal(NumericVar *arg, NumericVar *result, int rscale)
*
* exp(x) = 1 + x + x^2/2! + x^3/3! + ...
*
- * Given the limited range of x, this should converge reasonably quickly. We
- * run the series until the terms fall below the local_rscale limit.
+ * Given the limited range of x, this should converge reasonably quickly.
+ * We run the series until the terms fall below the local_rscale limit.
*/
add_var(&const_one, &x, result);
set_var_from_var(&x, &xpow);
@@ -4522,11 +4522,11 @@ ln_var(NumericVar *arg, NumericVar *result, int rscale)
*
* z + z^3/3 + z^5/5 + ...
*
- * where z = (x-1)/(x+1) is in the range (approximately) -0.053 .. 0.048 due
- * to the above range-reduction of x.
+ * where z = (x-1)/(x+1) is in the range (approximately) -0.053 .. 0.048
+ * due to the above range-reduction of x.
*
- * The convergence of this is not as fast as one would like, but is tolerable
- * given that z is small.
+ * The convergence of this is not as fast as one would like, but is
+ * tolerable given that z is small.
*/
sub_var(&x, &const_one, result);
add_var(&x, &const_one, &elem);
diff --git a/src/backend/utils/adt/oid.c b/src/backend/utils/adt/oid.c
index e400c9a1b4f..c31dbf4f666 100644
--- a/src/backend/utils/adt/oid.c
+++ b/src/backend/utils/adt/oid.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.65 2005/11/17 22:14:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.66 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -92,12 +92,12 @@ oidin_subr(const char *funcname, const char *s, char **endloc)
* case strtoul will not raise an error for some values that are out of
* the range of Oid.
*
- * For backwards compatibility, we want to accept inputs that are given with
- * a minus sign, so allow the input value if it matches after either
+ * For backwards compatibility, we want to accept inputs that are given
+ * with a minus sign, so allow the input value if it matches after either
* signed or unsigned extension to long.
*
- * To ensure consistent results on 32-bit and 64-bit platforms, make sure the
- * error message is the same as if strtoul() had returned ERANGE.
+ * To ensure consistent results on 32-bit and 64-bit platforms, make sure
+ * the error message is the same as if strtoul() had returned ERANGE.
*/
#if OID_MAX != ULONG_MAX
if (cvt != (unsigned long) result &&
diff --git a/src/backend/utils/adt/pg_lzcompress.c b/src/backend/utils/adt/pg_lzcompress.c
index 48d93d0602c..dc3708deb3d 100644
--- a/src/backend/utils/adt/pg_lzcompress.c
+++ b/src/backend/utils/adt/pg_lzcompress.c
@@ -1,7 +1,7 @@
/* ----------
* pg_lzcompress.c -
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.20 2005/10/15 02:49:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/pg_lzcompress.c,v 1.21 2005/11/22 18:17:23 momjian Exp $
*
* This is an implementation of LZ compression for PostgreSQL.
* It uses a simple history table and generates 2-3 byte tags
@@ -782,9 +782,9 @@ pglz_get_next_decomp_char_from_lzdata(PGLZ_DecompState *dstate)
* function and a difference occurs early). Otherwise, all the checks,
* needed here, cause too much overhead.
*
- * Thus we decompress the entire rest at once into the temporary buffer
- * and change the decomp state to return the prepared data from the
- * buffer by the more simple calls to
+ * Thus we decompress the entire rest at once into the temporary
+ * buffer and change the decomp state to return the prepared data from
+ * the buffer by the more simple calls to
* pglz_get_next_decomp_char_from_plain().
*/
if (dstate->cp_out - dstate->temp_buf >= 256)
diff --git a/src/backend/utils/adt/regexp.c b/src/backend/utils/adt/regexp.c
index ce04ce77e67..1820cedfa19 100644
--- a/src/backend/utils/adt/regexp.c
+++ b/src/backend/utils/adt/regexp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.60 2005/10/18 20:38:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/regexp.c,v 1.61 2005/11/22 18:17:23 momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
@@ -212,7 +212,7 @@ RE_compile_and_execute(text *text_re, char *dat, int dat_len,
pg_wchar *data;
size_t data_len;
int regexec_result;
- regex_t *re;
+ regex_t *re;
char errMsg[100];
/* Convert data string to wide characters */
@@ -452,7 +452,7 @@ textregexreplace_noopt(PG_FUNCTION_ARGS)
text *s = PG_GETARG_TEXT_P(0);
text *p = PG_GETARG_TEXT_P(1);
text *r = PG_GETARG_TEXT_P(2);
- regex_t *re;
+ regex_t *re;
re = RE_compile_and_cache(p, regex_flavor);
@@ -475,7 +475,7 @@ textregexreplace(PG_FUNCTION_ARGS)
int i;
bool glob = false;
bool ignorecase = false;
- regex_t *re;
+ regex_t *re;
/* parse options */
for (i = 0; i < opt_len; i++)
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c
index 347f82d8c3d..354fed20c45 100644
--- a/src/backend/utils/adt/ri_triggers.c
+++ b/src/backend/utils/adt/ri_triggers.c
@@ -17,7 +17,7 @@
*
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.82 2005/10/29 18:39:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.83 2005/11/22 18:17:23 momjian Exp $
*
* ----------
*/
@@ -995,8 +995,8 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * DELETE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual DELETE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
@@ -1156,8 +1156,8 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
* Get the relation descriptors of the FK and PK tables and the new and
* old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
@@ -1680,8 +1680,8 @@ RI_FKey_setnull_del(PG_FUNCTION_ARGS)
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
@@ -1849,8 +1849,8 @@ RI_FKey_setnull_upd(PG_FUNCTION_ARGS)
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
@@ -2059,8 +2059,8 @@ RI_FKey_setdefault_del(PG_FUNCTION_ARGS)
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
@@ -2238,8 +2238,8 @@ RI_FKey_setdefault_upd(PG_FUNCTION_ARGS)
/*
* Get the relation descriptors of the FK and PK tables and the old tuple.
*
- * fk_rel is opened in RowExclusiveLock mode since that's what our eventual
- * UPDATE will get on it.
+ * fk_rel is opened in RowExclusiveLock mode since that's what our
+ * eventual UPDATE will get on it.
*/
fk_rel = heap_open(trigdata->tg_trigger->tgconstrrelid, RowExclusiveLock);
pk_rel = trigdata->tg_relation;
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 5411e6ab8c5..c7b8066cbfb 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -3,7 +3,7 @@
* back to source text
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.208 2005/11/17 22:14:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.209 2005/11/22 18:17:23 momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -3845,8 +3845,8 @@ get_const_expr(Const *constval, deparse_context *context)
* 'NaN'). Note that strtod() and friends might accept NaN,
* so we can't use that to test.
*
- * In reality we only need to defend against infinity and NaN, so
- * we need not get too crazy about pattern matching here.
+ * In reality we only need to defend against infinity and NaN,
+ * so we need not get too crazy about pattern matching here.
*/
if (strspn(extval, "0123456789+-eE.") == strlen(extval))
{
@@ -4579,8 +4579,8 @@ quote_identifier(const char *ident)
* parser doesn't provide any easy way to test for whether an
* identifier is safe or not... so be safe not sorry.
*
- * Note: ScanKeywordLookup() does case-insensitive comparison, but that's
- * fine, since we already know we have all-lower-case.
+ * Note: ScanKeywordLookup() does case-insensitive comparison, but
+ * that's fine, since we already know we have all-lower-case.
*/
if (ScanKeywordLookup(ident) != NULL)
safe = false;
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index 85c22ca6c45..9ff98f05cbe 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.192 2005/11/07 17:36:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.193 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1396,11 +1396,11 @@ eqjoinsel(PG_FUNCTION_ARGS)
* the righthand relation are unique (ie, act as if it's been
* DISTINCT'd).
*
- * NOTE: it might seem that we should unique-ify the lefthand input when
- * considering JOIN_REVERSE_IN. But this is not so, because the join
- * clause we've been handed has not been commuted from the way the
- * parser originally wrote it. We know that the unique side of the IN
- * clause is *always* on the right.
+ * NOTE: it might seem that we should unique-ify the lefthand input
+ * when considering JOIN_REVERSE_IN. But this is not so, because the
+ * join clause we've been handed has not been commuted from the way
+ * the parser originally wrote it. We know that the unique side of
+ * the IN clause is *always* on the right.
*
* NOTE: it would be dangerous to try to be smart about JOIN_LEFT or
* JOIN_RIGHT here, because we do not have enough information to
@@ -2190,8 +2190,8 @@ estimate_hash_bucketsize(PlannerInfo *root, Node *hashkey, double nbuckets)
* assuming that the data distribution is affected uniformly by the
* restriction clauses!
*
- * XXX Possibly better way, but much more expensive: multiply by selectivity
- * of rel's restriction clauses that mention the target Var.
+ * XXX Possibly better way, but much more expensive: multiply by
+ * selectivity of rel's restriction clauses that mention the target Var.
*/
if (vardata.rel)
ndistinct *= vardata.rel->rows / vardata.rel->tuples;
@@ -2296,10 +2296,10 @@ convert_to_scalar(Datum value, Oid valuetypid, double *scaledvalue,
* declared input type(s) of the operator we are invoked for, so we just
* error out if either is not recognized.
*
- * XXX The histogram we are interpolating between points of could belong to a
- * column that's only binary-compatible with the declared type. In essence
- * we are assuming that the semantics of binary-compatible types are
- * enough alike that we can use a histogram generated with one type's
+ * XXX The histogram we are interpolating between points of could belong
+ * to a column that's only binary-compatible with the declared type. In
+ * essence we are assuming that the semantics of binary-compatible types
+ * are enough alike that we can use a histogram generated with one type's
* operators to estimate selectivity for the other's. This is outright
* wrong in some cases --- in particular signed versus unsigned
* interpretation could trip us up. But it's useful enough in the
@@ -2636,10 +2636,10 @@ convert_string_datum(Datum value, Oid typid)
* that can write past the specified buffer length in that scenario.
* So, do it the dumb way for portability.
*
- * Yet other systems (e.g., glibc) sometimes return a smaller value from
- * the second call than the first; thus the Assert must be <= not ==
- * as you'd expect. Can't any of these people program their way out
- * of a paper bag?
+ * Yet other systems (e.g., glibc) sometimes return a smaller value
+ * from the second call than the first; thus the Assert must be <= not
+ * == as you'd expect. Can't any of these people program their way
+ * out of a paper bag?
*/
xfrmlen = strxfrm(NULL, val, 0);
xfrmstr = (char *) palloc(xfrmlen + 1);
@@ -3150,7 +3150,8 @@ get_variable_numdistinct(VariableStatData *vardata)
/*
* Special-case boolean columns: presumably, two distinct values.
*
- * Are there any other datatypes we should wire in special estimates for?
+ * Are there any other datatypes we should wire in special estimates
+ * for?
*/
stadistinct = 2.0;
}
@@ -3265,8 +3266,9 @@ get_variable_maximum(PlannerInfo *root, VariableStatData *vardata,
/*
* If there is a histogram, grab the last or first value as appropriate.
*
- * If there is a histogram that is sorted with some other operator than the
- * one we want, fail --- this suggests that there is data we can't use.
+ * If there is a histogram that is sorted with some other operator than
+ * the one we want, fail --- this suggests that there is data we can't
+ * use.
*/
if (get_attstatsslot(vardata->statsTuple,
vardata->atttype, vardata->atttypmod,
@@ -4214,8 +4216,8 @@ genericcostestimate(PlannerInfo *root,
* system in favor of using partial indexes where possible, which is not
* necessarily a bad thing. But it'd be nice to do better someday.
*
- * Note that index->indpred and indexQuals are both in implicit-AND form, so
- * ANDing them together just takes merging the lists. However,
+ * Note that index->indpred and indexQuals are both in implicit-AND form,
+ * so ANDing them together just takes merging the lists. However,
* eliminating duplicates is a bit trickier because indexQuals contains
* RestrictInfo nodes and the indpred does not. It is okay to pass a
* mixed list to clauselist_selectivity, but we have to work a bit to
@@ -4261,8 +4263,8 @@ genericcostestimate(PlannerInfo *root,
/*
* Estimate the number of index pages that will be retrieved.
*
- * For all currently-supported index types, the first page of the index is a
- * metadata page, and we should figure on fetching that plus a pro-rated
+ * For all currently-supported index types, the first page of the index is
+ * a metadata page, and we should figure on fetching that plus a pro-rated
* fraction of the remaining pages.
*/
if (index->pages > 1 && index->tuples > 0)
@@ -4289,9 +4291,9 @@ genericcostestimate(PlannerInfo *root,
* CPU costs as cpu_index_tuple_cost plus one cpu_operator_cost per
* indexqual operator.
*
- * Note: this neglects the possible costs of rechecking lossy operators and
- * OR-clause expressions. Detecting that that might be needed seems more
- * expensive than it's worth, though, considering all the other
+ * Note: this neglects the possible costs of rechecking lossy operators
+ * and OR-clause expressions. Detecting that that might be needed seems
+ * more expensive than it's worth, though, considering all the other
* inaccuracies here ...
*/
cost_qual_eval(&index_qual_cost, indexQuals);
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index ec2e80fc2a6..c04a735aae9 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.158 2005/11/17 22:14:53 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.159 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1944,30 +1944,22 @@ timestamp_mi(PG_FUNCTION_ARGS)
result->day = 0;
/*
- * This is wrong, but removing it breaks a lot of regression tests.
- * For example:
+ * This is wrong, but removing it breaks a lot of regression tests. For
+ * example:
*
- * test=> SET timezone = 'EST5EDT';
- * test=> SELECT
- * test-> ('2005-10-30 13:22:00-05'::timestamptz -
- * test(> '2005-10-29 13:22:00-04'::timestamptz);
- * ?column?
- * ----------------
- * 1 day 01:00:00
- * (1 row)
+ * test=> SET timezone = 'EST5EDT'; test=> SELECT test-> ('2005-10-30
+ * 13:22:00-05'::timestamptz - test(> '2005-10-29
+ * 13:22:00-04'::timestamptz); ?column? ---------------- 1 day 01:00:00 (1
+ * row)
*
- * so adding that to the first timestamp gets:
+ * so adding that to the first timestamp gets:
*
- * test=> SELECT
- * test-> ('2005-10-29 13:22:00-04'::timestamptz +
- * test(> ('2005-10-30 13:22:00-05'::timestamptz -
- * test(> '2005-10-29 13:22:00-04'::timestamptz)) at time zone 'EST';
- * timezone
- * --------------------
- * 2005-10-30 14:22:00
- * (1 row)
+ * test=> SELECT test-> ('2005-10-29 13:22:00-04'::timestamptz + test(>
+ * ('2005-10-30 13:22:00-05'::timestamptz - test(> '2005-10-29
+ * 13:22:00-04'::timestamptz)) at time zone 'EST'; timezone
+ * -------------------- 2005-10-30 14:22:00 (1 row)
*/
- result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
+ result = DatumGetIntervalP(DirectFunctionCall1(interval_justify_hours,
IntervalPGetDatum(result)));
PG_RETURN_INTERVAL_P(result);
@@ -1986,6 +1978,7 @@ interval_justify_hours(PG_FUNCTION_ARGS)
{
Interval *span = PG_GETARG_INTERVAL_P(0);
Interval *result;
+
#ifdef HAVE_INT64_TIMESTAMP
int64 wholeday;
#else
@@ -2334,12 +2327,12 @@ interval_mul(PG_FUNCTION_ARGS)
day_remainder -= result->day;
/*
- * The above correctly handles the whole-number part of the month and
- * day products, but we have to do something with any fractional part
+ * The above correctly handles the whole-number part of the month and day
+ * products, but we have to do something with any fractional part
* resulting when the factor is nonintegral. We cascade the fractions
* down to lower units using the conversion factors DAYS_PER_MONTH and
- * SECS_PER_DAY. Note we do NOT cascade up, since we are not forced to
- * do so by the representation. The user can choose to cascade up later,
+ * SECS_PER_DAY. Note we do NOT cascade up, since we are not forced to do
+ * so by the representation. The user can choose to cascade up later,
* using justify_hours and/or justify_days.
*/
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c
index dd877c7d3f0..69544ea90f6 100644
--- a/src/backend/utils/adt/varlena.c
+++ b/src/backend/utils/adt/varlena.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.140 2005/11/18 02:38:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/varlena.c,v 1.141 2005/11/22 18:17:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -888,8 +888,8 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2)
(LPWSTR) a1p, a1len / 2);
if (!r)
ereport(ERROR,
- (errmsg("could not convert string to UTF-16: error %lu",
- GetLastError())));
+ (errmsg("could not convert string to UTF-16: error %lu",
+ GetLastError())));
}
((LPWSTR) a1p)[r] = 0;
@@ -901,8 +901,8 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2)
(LPWSTR) a2p, a2len / 2);
if (!r)
ereport(ERROR,
- (errmsg("could not convert string to UTF-16: error %lu",
- GetLastError())));
+ (errmsg("could not convert string to UTF-16: error %lu",
+ GetLastError())));
}
((LPWSTR) a2p)[r] = 0;
@@ -2118,12 +2118,12 @@ appendStringInfoRegexpSubstr(StringInfo str, text *replace_text,
if (eml == 1)
{
for (; p < p_end && *p != '\\'; p++)
- /* nothing */ ;
+ /* nothing */ ;
}
else
{
for (; p < p_end && *p != '\\'; p += pg_mblen(p))
- /* nothing */ ;
+ /* nothing */ ;
}
/* Copy the text we just scanned over, if any. */
@@ -2168,9 +2168,9 @@ appendStringInfoRegexpSubstr(StringInfo str, text *replace_text,
else
{
/*
- * If escape char is not followed by any expected char,
- * just treat it as ordinary data to copy. (XXX would it be
- * better to throw an error?)
+ * If escape char is not followed by any expected char, just treat
+ * it as ordinary data to copy. (XXX would it be better to throw
+ * an error?)
*/
appendStringInfoChar(str, '\\');
continue;
@@ -2179,7 +2179,7 @@ appendStringInfoRegexpSubstr(StringInfo str, text *replace_text,
if (so != -1 && eo != -1)
{
/*
- * Copy the text that is back reference of regexp. Because so and
+ * Copy the text that is back reference of regexp. Because so and
* eo are counted in characters not bytes, it's easiest to use
* text_substring to pull out the correct chunk of text.
*/
@@ -2252,9 +2252,9 @@ replace_text_regexp(text *src_text, void *regexp,
break;
/*
- * Copy the text to the left of the match position. Because we
- * are working with character not byte indexes, it's easiest to
- * use text_substring to pull out the needed data.
+ * Copy the text to the left of the match position. Because we are
+ * working with character not byte indexes, it's easiest to use
+ * text_substring to pull out the needed data.
*/
if (pmatch[0].rm_so - data_pos > 0)
{