diff options
Diffstat (limited to 'src/backend/utils')
45 files changed, 491 insertions, 476 deletions
diff --git a/src/backend/utils/adt/acl.c b/src/backend/utils/adt/acl.c index 2f27018b256..dc75ad86ce2 100644 --- a/src/backend/utils/adt/acl.c +++ b/src/backend/utils/adt/acl.c @@ -113,7 +113,7 @@ static AclMode convert_role_priv_string(text *priv_type_text); static AclResult pg_role_aclcheck(Oid role_oid, Oid roleid, AclMode mode); static void RoleMembershipCacheCallback(Datum arg, int cacheid, ItemPointer tuplePtr); -static Oid get_role_oid_or_public(const char *rolname); +static Oid get_role_oid_or_public(const char *rolname); /* @@ -4829,7 +4829,7 @@ get_role_oid(const char *rolname, bool missing_ok) /* * get_role_oid_or_public - As above, but return ACL_ID_PUBLIC if the - * role name is "public". + * role name is "public". */ static Oid get_role_oid_or_public(const char *rolname) diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index e023b2458ed..0869de66cef 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -72,7 +72,7 @@ typedef struct ArrayIteratorData /* current position information, updated on each iteration */ char *data_ptr; /* our current position in the array */ int current_item; /* the item # we're at in the array */ -} ArrayIteratorData; +} ArrayIteratorData; static bool array_isspace(char ch); static int ArrayCount(const char *str, int *dim, char typdelim); @@ -1268,7 +1268,8 @@ array_recv(PG_FUNCTION_ARGS) */ if (dim[i] != 0) { - int ub = lBound[i] + dim[i] - 1; + int ub = lBound[i] + dim[i] - 1; + if (lBound[i] > ub) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c index 4c3279759d5..faef6f83813 100644 --- a/src/backend/utils/adt/cash.c +++ b/src/backend/utils/adt/cash.c @@ -945,11 +945,11 @@ numeric_cash(PG_FUNCTION_ARGS) Datum int4_cash(PG_FUNCTION_ARGS) { - int32 amount = PG_GETARG_INT32(0); - Cash result; - int fpoint; - int64 scale; - int i; + int32 amount = PG_GETARG_INT32(0); + Cash result; + int fpoint; + int64 scale; + int i; struct lconv *lconvert = PGLC_localeconv(); /* see comments about frac_digits in cash_in() */ @@ -964,7 +964,7 @@ int4_cash(PG_FUNCTION_ARGS) /* compute amount * scale, checking for overflow */ result = DatumGetInt64(DirectFunctionCall2(int8mul, Int64GetDatum(amount), - Int64GetDatum(scale))); + Int64GetDatum(scale))); PG_RETURN_CASH(result); } @@ -975,11 +975,11 @@ int4_cash(PG_FUNCTION_ARGS) Datum int8_cash(PG_FUNCTION_ARGS) { - int64 amount = PG_GETARG_INT64(0); - Cash result; - int fpoint; - int64 scale; - int i; + int64 amount = PG_GETARG_INT64(0); + Cash result; + int fpoint; + int64 scale; + int i; struct lconv *lconvert = PGLC_localeconv(); /* see comments about frac_digits in cash_in() */ @@ -994,7 +994,7 @@ int8_cash(PG_FUNCTION_ARGS) /* compute amount * scale, checking for overflow */ result = DatumGetInt64(DirectFunctionCall2(int8mul, Int64GetDatum(amount), - Int64GetDatum(scale))); + Int64GetDatum(scale))); PG_RETURN_CASH(result); } diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index f96fa6cb72e..e737e720f5b 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -472,7 +472,7 @@ date2timestamptz(DateADT dateVal) double date2timestamp_no_overflow(DateADT dateVal) { - double result; + double result; if (DATE_IS_NOBEGIN(dateVal)) result = -DBL_MAX; diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 0410b8384e9..db0a6487acf 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -2397,7 +2397,7 @@ DecodeTime(char *str, int fmask, int range, /* do a sanity check */ #ifdef HAVE_INT64_TIMESTAMP - if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_min > MINS_PER_HOUR -1 || + if (tm->tm_hour < 0 || tm->tm_min < 0 || tm->tm_min > MINS_PER_HOUR - 1 || tm->tm_sec < 0 || tm->tm_sec > SECS_PER_MINUTE || *fsec < INT64CONST(0) || *fsec > USECS_PER_SEC) diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index 543a244bf99..73a6ad32808 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -634,7 +634,7 @@ pg_relation_filepath(PG_FUNCTION_ARGS) break; default: elog(ERROR, "invalid relpersistence: %c", relform->relpersistence); - backend = InvalidBackendId; /* placate compiler */ + backend = InvalidBackendId; /* placate compiler */ break; } diff --git a/src/backend/utils/adt/enum.c b/src/backend/utils/adt/enum.c index be4f984ed68..8f65c84d305 100644 --- a/src/backend/utils/adt/enum.c +++ b/src/backend/utils/adt/enum.c @@ -461,7 +461,7 @@ enum_range_internal(Oid enumtypoid, Oid lower, Oid upper) Datum *elems; int max, cnt; - bool left_found; + bool left_found; /* * Scan the enum members in order using pg_enum_typid_sortorder_index. @@ -486,7 +486,7 @@ enum_range_internal(Oid enumtypoid, Oid lower, Oid upper) while (HeapTupleIsValid(enum_tuple = systable_getnext_ordered(enum_scan, ForwardScanDirection))) { - Oid enum_oid = HeapTupleGetOid(enum_tuple); + Oid enum_oid = HeapTupleGetOid(enum_tuple); if (!left_found && lower == enum_oid) left_found = true; diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 45e36f92e50..f895bbbb8b9 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -662,7 +662,7 @@ typedef enum /* last */ _DCH_last_ -} DCH_poz; +} DCH_poz; typedef enum { @@ -705,7 +705,7 @@ typedef enum /* last */ _NUM_last_ -} NUM_poz; +} NUM_poz; /* ---------- * KeyWords for DATE-TIME version @@ -1497,7 +1497,7 @@ str_tolower(const char *buff, size_t nbytes, Oid collid) #ifdef USE_WIDE_UPPER_LOWER else if (pg_database_encoding_max_length() > 1) { - pg_locale_t mylocale = 0; + pg_locale_t mylocale = 0; wchar_t *workspace; size_t curr_char; size_t result_size; @@ -1549,7 +1549,7 @@ str_tolower(const char *buff, size_t nbytes, Oid collid) #endif /* USE_WIDE_UPPER_LOWER */ else { - pg_locale_t mylocale = 0; + pg_locale_t mylocale = 0; char *p; if (collid != DEFAULT_COLLATION_OID) @@ -1618,7 +1618,7 @@ str_toupper(const char *buff, size_t nbytes, Oid collid) #ifdef USE_WIDE_UPPER_LOWER else if (pg_database_encoding_max_length() > 1) { - pg_locale_t mylocale = 0; + pg_locale_t mylocale = 0; wchar_t *workspace; size_t curr_char; size_t result_size; @@ -1670,7 +1670,7 @@ str_toupper(const char *buff, size_t nbytes, Oid collid) #endif /* USE_WIDE_UPPER_LOWER */ else { - pg_locale_t mylocale = 0; + pg_locale_t mylocale = 0; char *p; if (collid != DEFAULT_COLLATION_OID) @@ -1736,7 +1736,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid) for (p = result; *p; p++) { - char c; + char c; if (wasalnum) *p = c = pg_ascii_tolower((unsigned char) *p); @@ -1751,7 +1751,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid) #ifdef USE_WIDE_UPPER_LOWER else if (pg_database_encoding_max_length() > 1) { - pg_locale_t mylocale = 0; + pg_locale_t mylocale = 0; wchar_t *workspace; size_t curr_char; size_t result_size; @@ -1815,7 +1815,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid) #endif /* USE_WIDE_UPPER_LOWER */ else { - pg_locale_t mylocale = 0; + pg_locale_t mylocale = 0; char *p; if (collid != DEFAULT_COLLATION_OID) @@ -1838,7 +1838,7 @@ str_initcap(const char *buff, size_t nbytes, Oid collid) /* * Note: we assume that toupper_l()/tolower_l() will not be so broken - * as to need guard tests. When using the default collation, we apply + * as to need guard tests. When using the default collation, we apply * the traditional Postgres behavior that forces ASCII-style treatment * of I/i, but in non-default collations you get exactly what the * collation says. @@ -2318,7 +2318,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col * intervals */ sprintf(s, "%0*d", S_FM(n->suffix) ? 0 : 2, - tm->tm_hour % (HOURS_PER_DAY / 2) == 0 ? HOURS_PER_DAY / 2 : + tm->tm_hour % (HOURS_PER_DAY / 2) == 0 ? HOURS_PER_DAY / 2 : tm->tm_hour % (HOURS_PER_DAY / 2)); if (S_THth(n->suffix)) str_numth(s, s, S_TH_TYPE(n->suffix)); @@ -2423,7 +2423,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col strcpy(s, str_toupper_z(localized_full_months[tm->tm_mon - 1], collid)); else sprintf(s, "%*s", S_FM(n->suffix) ? 0 : -9, - str_toupper_z(months_full[tm->tm_mon - 1], collid)); + str_toupper_z(months_full[tm->tm_mon - 1], collid)); s += strlen(s); break; case DCH_Month: diff --git a/src/backend/utils/adt/genfile.c b/src/backend/utils/adt/genfile.c index 7c59e9a20ef..6b3f77fec14 100644 --- a/src/backend/utils/adt/genfile.c +++ b/src/backend/utils/adt/genfile.c @@ -56,18 +56,19 @@ convert_and_check_filename(text *arg) /* Disallow '/a/b/data/..' */ if (path_contains_parent_reference(filename)) ereport(ERROR, - (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("reference to parent directory (\"..\") not allowed")))); + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + (errmsg("reference to parent directory (\"..\") not allowed")))); + /* - * Allow absolute paths if within DataDir or Log_directory, even - * though Log_directory might be outside DataDir. + * Allow absolute paths if within DataDir or Log_directory, even + * though Log_directory might be outside DataDir. */ if (!path_is_prefix_of_path(DataDir, filename) && (!is_absolute_path(Log_directory) || !path_is_prefix_of_path(Log_directory, filename))) ereport(ERROR, - (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), - (errmsg("absolute path not allowed")))); + (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), + (errmsg("absolute path not allowed")))); } else if (!path_is_relative_and_below_cwd(filename)) ereport(ERROR, diff --git a/src/backend/utils/adt/like.c b/src/backend/utils/adt/like.c index b060faa6a9b..0934c69ebe5 100644 --- a/src/backend/utils/adt/like.c +++ b/src/backend/utils/adt/like.c @@ -30,19 +30,19 @@ #define LIKE_ABORT (-1) -static int SB_MatchText(char *t, int tlen, char *p, int plen, - pg_locale_t locale, bool locale_is_c); +static int SB_MatchText(char *t, int tlen, char *p, int plen, + pg_locale_t locale, bool locale_is_c); static text *SB_do_like_escape(text *, text *); -static int MB_MatchText(char *t, int tlen, char *p, int plen, - pg_locale_t locale, bool locale_is_c); +static int MB_MatchText(char *t, int tlen, char *p, int plen, + pg_locale_t locale, bool locale_is_c); static text *MB_do_like_escape(text *, text *); -static int UTF8_MatchText(char *t, int tlen, char *p, int plen, - pg_locale_t locale, bool locale_is_c); +static int UTF8_MatchText(char *t, int tlen, char *p, int plen, + pg_locale_t locale, bool locale_is_c); -static int SB_IMatchText(char *t, int tlen, char *p, int plen, - pg_locale_t locale, bool locale_is_c); +static int SB_IMatchText(char *t, int tlen, char *p, int plen, + pg_locale_t locale, bool locale_is_c); static int GenericMatchText(char *s, int slen, char *p, int plen); static int Generic_Text_IC_like(text *str, text *pat, Oid collation); @@ -188,11 +188,11 @@ Generic_Text_IC_like(text *str, text *pat, Oid collation) else { /* - * Here we need to prepare locale information for SB_lower_char. - * This should match the methods used in str_tolower(). + * Here we need to prepare locale information for SB_lower_char. This + * should match the methods used in str_tolower(). */ - pg_locale_t locale = 0; - bool locale_is_c = false; + pg_locale_t locale = 0; + bool locale_is_c = false; if (lc_ctype_is_c(collation)) locale_is_c = true; diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 4b61b21cbed..6771e78af8e 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -182,8 +182,8 @@ tm2abstime(struct pg_tm * tm, int tz) tm->tm_mon < 1 || tm->tm_mon > MONTHS_PER_YEAR || tm->tm_mday < 1 || tm->tm_mday > 31 || tm->tm_hour < 0 || - tm->tm_hour > HOURS_PER_DAY || /* test for > 24:00:00 */ - (tm->tm_hour == HOURS_PER_DAY && (tm->tm_min > 0 || tm->tm_sec > 0)) || + tm->tm_hour > HOURS_PER_DAY || /* test for > 24:00:00 */ + (tm->tm_hour == HOURS_PER_DAY && (tm->tm_min > 0 || tm->tm_sec > 0)) || tm->tm_min < 0 || tm->tm_min > MINS_PER_HOUR - 1 || tm->tm_sec < 0 || tm->tm_sec > SECS_PER_MINUTE) return INVALID_ABSTIME; @@ -1163,7 +1163,7 @@ tintervalsame(PG_FUNCTION_ARGS) * 1. The interval length computations overflow at 2^31 seconds, causing * intervals longer than that to sort oddly compared to those shorter. * 2. infinity and minus infinity (NOEND_ABSTIME and NOSTART_ABSTIME) are - * just ordinary integers. Since this code doesn't handle them specially, + * just ordinary integers. Since this code doesn't handle them specially, * it's possible for [a b] to be considered longer than [c infinity] for * finite abstimes a, b, c. In combination with the previous point, the * interval [-infinity infinity] is treated as being shorter than many finite diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c index 8cac11134c4..80e5915b3e5 100644 --- a/src/backend/utils/adt/network.c +++ b/src/backend/utils/adt/network.c @@ -319,7 +319,7 @@ inet_to_cidr(PG_FUNCTION_ARGS) inet *src = PG_GETARG_INET_P(0); inet *dst; int bits; - int byte; + int byte; int nbits; int maxbytes; @@ -340,15 +340,15 @@ inet_to_cidr(PG_FUNCTION_ARGS) /* clear the first byte, this might be a partial byte */ if (nbits != 0) { - ip_addr(dst)[byte] &=~(0xFF >> nbits); - byte ++; + ip_addr(dst)[byte] &= ~(0xFF >> nbits); + byte++; } /* clear remaining bytes */ maxbytes = ip_addrsize(dst); - while (byte <maxbytes) + while (byte < maxbytes) { ip_addr(dst)[byte] = 0; - byte ++; + byte++; } PG_RETURN_INET_P(dst); @@ -384,7 +384,7 @@ cidr_set_masklen(PG_FUNCTION_ARGS) inet *src = PG_GETARG_INET_P(0); int bits = PG_GETARG_INT32(1); inet *dst; - int byte; + int byte; int nbits; int maxbytes; @@ -409,15 +409,15 @@ cidr_set_masklen(PG_FUNCTION_ARGS) /* clear the first byte, this might be a partial byte */ if (nbits != 0) { - ip_addr(dst)[byte] &=~(0xFF >> nbits); - byte ++; + ip_addr(dst)[byte] &= ~(0xFF >> nbits); + byte++; } /* clear remaining bytes */ maxbytes = ip_addrsize(dst); - while (byte <maxbytes) + while (byte < maxbytes) { ip_addr(dst)[byte] = 0; - byte ++; + byte++; } PG_RETURN_INET_P(dst); @@ -716,7 +716,7 @@ network_broadcast(PG_FUNCTION_ARGS) { inet *ip = PG_GETARG_INET_P(0); inet *dst; - int byte; + int byte; int bits; int maxbytes; unsigned char mask; @@ -735,7 +735,7 @@ network_broadcast(PG_FUNCTION_ARGS) a = ip_addr(ip); b = ip_addr(dst); - for (byte = 0; byte <maxbytes; byte ++) + for (byte = 0; byte < maxbytes; byte++) { if (bits >= 8) { @@ -750,7 +750,7 @@ network_broadcast(PG_FUNCTION_ARGS) bits = 0; } - b[byte] = a[byte] |mask; + b[byte] = a[byte] | mask; } ip_family(dst) = ip_family(ip); @@ -765,7 +765,7 @@ network_network(PG_FUNCTION_ARGS) { inet *ip = PG_GETARG_INET_P(0); inet *dst; - int byte; + int byte; int bits; unsigned char mask; unsigned char *a, @@ -793,8 +793,8 @@ network_network(PG_FUNCTION_ARGS) bits = 0; } - b[byte] = a[byte] &mask; - byte ++; + b[byte] = a[byte] & mask; + byte++; } ip_family(dst) = ip_family(ip); @@ -809,7 +809,7 @@ network_netmask(PG_FUNCTION_ARGS) { inet *ip = PG_GETARG_INET_P(0); inet *dst; - int byte; + int byte; int bits; unsigned char mask; unsigned char *b; @@ -836,7 +836,7 @@ network_netmask(PG_FUNCTION_ARGS) } b[byte] = mask; - byte ++; + byte++; } ip_family(dst) = ip_family(ip); @@ -851,7 +851,7 @@ network_hostmask(PG_FUNCTION_ARGS) { inet *ip = PG_GETARG_INET_P(0); inet *dst; - int byte; + int byte; int bits; int maxbytes; unsigned char mask; @@ -884,7 +884,7 @@ network_hostmask(PG_FUNCTION_ARGS) } b[byte] = mask; - byte --; + byte--; } ip_family(dst) = ip_family(ip); @@ -994,7 +994,7 @@ bitncmp(void *l, void *r, int n) static bool addressOK(unsigned char *a, int bits, int family) { - int byte; + int byte; int nbits; int maxbits; int maxbytes; @@ -1022,12 +1022,12 @@ addressOK(unsigned char *a, int bits, int family) if (bits != 0) mask >>= nbits; - while (byte <maxbytes) + while (byte < maxbytes) { - if ((a[byte] &mask) != 0) + if ((a[byte] & mask) != 0) return false; mask = 0xff; - byte ++; + byte++; } return true; @@ -1396,7 +1396,7 @@ inetmi(PG_FUNCTION_ARGS) * two's complement, too bad. */ int nb = ip_addrsize(ip); - int byte = 0; + int byte = 0; unsigned char *pip = ip_addr(ip); unsigned char *pip2 = ip_addr(ip2); int carry = 1; @@ -1407,9 +1407,9 @@ inetmi(PG_FUNCTION_ARGS) carry = pip[nb] + (~pip2[nb] & 0xFF) + carry; lobyte = carry & 0xFF; - if (byte <sizeof(int64)) + if (byte < sizeof(int64)) { - res |= ((int64) lobyte) << (byte *8); + res |= ((int64) lobyte) << (byte * 8); } else { @@ -1424,15 +1424,15 @@ inetmi(PG_FUNCTION_ARGS) errmsg("result is out of range"))); } carry >>= 8; - byte ++; + byte++; } /* * If input is narrower than int64, overflow is not possible, but we * have to do proper sign extension. */ - if (carry == 0 && byte <sizeof(int64)) - res |= ((int64) -1) << (byte *8); + if (carry == 0 && byte < sizeof(int64)) + res |= ((int64) -1) << (byte * 8); } PG_RETURN_INT64(res); diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index eec89aa54f2..6b60a5c1c78 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -94,11 +94,11 @@ typedef int16 NumericDigit; * If the high bits of the first word of a NumericChoice (n_header, or * n_short.n_header, or n_long.n_sign_dscale) are NUMERIC_SHORT, then the * numeric follows the NumericShort format; if they are NUMERIC_POS or - * NUMERIC_NEG, it follows the NumericLong format. If they are NUMERIC_NAN, + * NUMERIC_NEG, it follows the NumericLong format. If they are NUMERIC_NAN, * it is a NaN. We currently always store a NaN using just two bytes (i.e. * only n_header), but previous releases used only the NumericLong format, * so we might find 4-byte NaNs on disk if a database has been migrated using - * pg_upgrade. In either case, when the high bits indicate a NaN, the + * pg_upgrade. In either case, when the high bits indicate a NaN, the * remaining bits are never examined. Currently, we always initialize these * to zero, but it might be possible to use them for some other purpose in * the future. @@ -134,14 +134,14 @@ struct NumericLong union NumericChoice { uint16 n_header; /* Header word */ - struct NumericLong n_long; /* Long form (4-byte header) */ - struct NumericShort n_short; /* Short form (2-byte header) */ + struct NumericLong n_long; /* Long form (4-byte header) */ + struct NumericShort n_short; /* Short form (2-byte header) */ }; struct NumericData { int32 vl_len_; /* varlena header (do not touch directly!) */ - union NumericChoice choice; /* choice of format */ + union NumericChoice choice; /* choice of format */ }; @@ -160,7 +160,7 @@ struct NumericData #define NUMERIC_IS_SHORT(n) (NUMERIC_FLAGBITS(n) == NUMERIC_SHORT) #define NUMERIC_HDRSZ (VARHDRSZ + sizeof(uint16) + sizeof(int16)) -#define NUMERIC_HDRSZ_SHORT (VARHDRSZ + sizeof(uint16)) +#define NUMERIC_HDRSZ_SHORT (VARHDRSZ + sizeof(uint16)) /* * If the flag bits are NUMERIC_SHORT or NUMERIC_NAN, we want the short header; @@ -189,7 +189,7 @@ struct NumericData * Extract sign, display scale, weight. */ -#define NUMERIC_DSCALE_MASK 0x3FFF +#define NUMERIC_DSCALE_MASK 0x3FFF #define NUMERIC_SIGN(n) \ (NUMERIC_IS_SHORT(n) ? \ @@ -551,7 +551,7 @@ numeric_out(PG_FUNCTION_ARGS) /* * numeric_is_nan() - * - * Is Numeric value a NaN? + * Is Numeric value a NaN? */ bool numeric_is_nan(Numeric num) @@ -562,13 +562,13 @@ numeric_is_nan(Numeric num) /* * numeric_maximum_size() - * - * Maximum size of a numeric with given typmod, or -1 if unlimited/unknown. + * Maximum size of a numeric with given typmod, or -1 if unlimited/unknown. */ int32 numeric_maximum_size(int32 typmod) { - int precision; - int numeric_digits; + int precision; + int numeric_digits; if (typmod < (int32) (VARHDRSZ)) return -1; @@ -577,23 +577,23 @@ numeric_maximum_size(int32 typmod) precision = ((typmod - VARHDRSZ) >> 16) & 0xffff; /* - * This formula computes the maximum number of NumericDigits we could - * need in order to store the specified number of decimal digits. - * Because the weight is stored as a number of NumericDigits rather - * than a number of decimal digits, it's possible that the first - * NumericDigit will contain only a single decimal digit. Thus, the - * first two decimal digits can require two NumericDigits to store, - * but it isn't until we reach DEC_DIGITS + 2 decimal digits that we - * potentially need a third NumericDigit. + * This formula computes the maximum number of NumericDigits we could need + * in order to store the specified number of decimal digits. Because the + * weight is stored as a number of NumericDigits rather than a number of + * decimal digits, it's possible that the first NumericDigit will contain + * only a single decimal digit. Thus, the first two decimal digits can + * require two NumericDigits to store, but it isn't until we reach + * DEC_DIGITS + 2 decimal digits that we potentially need a third + * NumericDigit. */ numeric_digits = (precision + 2 * (DEC_DIGITS - 1)) / DEC_DIGITS; /* * In most cases, the size of a numeric will be smaller than the value * computed below, because the varlena header will typically get toasted - * down to a single byte before being stored on disk, and it may also - * be possible to use a short numeric header. But our job here is to - * compute the worst case. + * down to a single byte before being stored on disk, and it may also be + * possible to use a short numeric header. But our job here is to compute + * the worst case. */ return NUMERIC_HDRSZ + (numeric_digits * sizeof(NumericDigit)); } @@ -761,12 +761,13 @@ numeric (PG_FUNCTION_ARGS) * If the number is certainly in bounds and due to the target scale no * rounding could be necessary, just make a copy of the input and modify * its scale fields, unless the larger scale forces us to abandon the - * short representation. (Note we assume the existing dscale is honest...) + * short representation. (Note we assume the existing dscale is + * honest...) */ ddigits = (NUMERIC_WEIGHT(num) + 1) * DEC_DIGITS; if (ddigits <= maxdigits && scale >= NUMERIC_DSCALE(num) && (NUMERIC_CAN_BE_SHORT(scale, NUMERIC_WEIGHT(num)) - || !NUMERIC_IS_SHORT(num))) + || !NUMERIC_IS_SHORT(num))) { new = (Numeric) palloc(VARSIZE(num)); memcpy(new, num, VARSIZE(num)); @@ -1427,7 +1428,7 @@ hash_numeric(PG_FUNCTION_ARGS) int end_offset; int i; int hash_len; - NumericDigit *digits; + NumericDigit *digits; /* If it's NaN, don't try to hash the rest of the fields */ if (NUMERIC_IS_NAN(key)) @@ -3727,7 +3728,7 @@ make_result(NumericVar *var) SET_VARSIZE(result, len); result->choice.n_short.n_header = (sign == NUMERIC_NEG ? (NUMERIC_SHORT | NUMERIC_SHORT_SIGN_MASK) - : NUMERIC_SHORT) + : NUMERIC_SHORT) | (var->dscale << NUMERIC_SHORT_DSCALE_SHIFT) | (weight < 0 ? NUMERIC_SHORT_WEIGHT_SIGN_MASK : 0) | (weight & NUMERIC_SHORT_WEIGHT_MASK); diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c index 38ce38821e1..37d208994c1 100644 --- a/src/backend/utils/adt/numutils.c +++ b/src/backend/utils/adt/numutils.c @@ -136,7 +136,7 @@ pg_ltoa(int32 value, char *a) * Avoid problems with the most negative integer not being representable * as a positive integer. */ - if (value == (-2147483647-1)) + if (value == (-2147483647 - 1)) { memcpy(a, "-2147483648", 12); return; @@ -150,8 +150,8 @@ pg_ltoa(int32 value, char *a) /* Compute the result string backwards. */ do { - int32 remainder; - int32 oldval = value; + int32 remainder; + int32 oldval = value; value /= 10; remainder = oldval - value * 10; @@ -167,7 +167,7 @@ pg_ltoa(int32 value, char *a) /* Reverse string. */ while (start < a) { - char swap = *start; + char swap = *start; *start++ = *a; *a-- = swap; @@ -190,7 +190,7 @@ pg_lltoa(int64 value, char *a) * Avoid problems with the most negative integer not being representable * as a positive integer. */ - if (value == (-INT64CONST(0x7FFFFFFFFFFFFFFF)-1)) + if (value == (-INT64CONST(0x7FFFFFFFFFFFFFFF) - 1)) { memcpy(a, "-9223372036854775808", 21); return; @@ -204,8 +204,8 @@ pg_lltoa(int64 value, char *a) /* Compute the result string backwards. */ do { - int64 remainder; - int64 oldval = value; + int64 remainder; + int64 oldval = value; value /= 10; remainder = oldval - value * 10; @@ -221,7 +221,7 @@ pg_lltoa(int64 value, char *a) /* Reverse string. */ while (start < a) { - char swap = *start; + char swap = *start; *start++ = *a; *a-- = swap; diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 09ff926cba6..0e6723d4690 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -107,7 +107,7 @@ typedef struct bool collate_is_c; /* is collation's LC_COLLATE C? */ bool ctype_is_c; /* is collation's LC_CTYPE C? */ bool flags_valid; /* true if above flags are valid */ - pg_locale_t locale; /* locale_t struct, or 0 if not valid */ + pg_locale_t locale; /* locale_t struct, or 0 if not valid */ } collation_cache_entry; static HTAB *collation_cache = NULL; @@ -242,7 +242,7 @@ check_locale(int category, const char *value) * * For most locale categories, the assign hook doesn't actually set the locale * permanently, just reset flags so that the next use will cache the - * appropriate values. (See explanation at the top of this file.) + * appropriate values. (See explanation at the top of this file.) * * Note: we accept value = "" as selecting the postmaster's environment * value, whatever it was (so long as the environment setting is legal). @@ -728,7 +728,6 @@ IsoLocaleName(const char *winlocname) return NULL; /* Not supported on this version of msvc/mingw */ #endif /* _MSC_VER >= 1400 */ } - #endif /* WIN32 && LC_MESSAGES */ @@ -750,7 +749,7 @@ IsoLocaleName(const char *winlocname) * could fail if the locale is C, so str_tolower() shouldn't call it * in that case. * - * Note that we currently lack any way to flush the cache. Since we don't + * Note that we currently lack any way to flush the cache. Since we don't * support ALTER COLLATION, this is OK. The worst case is that someone * drops a collation, and a useless cache entry hangs around in existing * backends. @@ -826,15 +825,15 @@ bool lc_collate_is_c(Oid collation) { /* - * If we're asked about "collation 0", return false, so that the code - * will go into the non-C path and report that the collation is bogus. + * If we're asked about "collation 0", return false, so that the code will + * go into the non-C path and report that the collation is bogus. */ if (!OidIsValid(collation)) return false; /* - * If we're asked about the default collation, we have to inquire of - * the C library. Cache the result so we only have to compute it once. + * If we're asked about the default collation, we have to inquire of the C + * library. Cache the result so we only have to compute it once. */ if (collation == DEFAULT_COLLATION_OID) { @@ -876,15 +875,15 @@ bool lc_ctype_is_c(Oid collation) { /* - * If we're asked about "collation 0", return false, so that the code - * will go into the non-C path and report that the collation is bogus. + * If we're asked about "collation 0", return false, so that the code will + * go into the non-C path and report that the collation is bogus. */ if (!OidIsValid(collation)) return false; /* - * If we're asked about the default collation, we have to inquire of - * the C library. Cache the result so we only have to compute it once. + * If we're asked about the default collation, we have to inquire of the C + * library. Cache the result so we only have to compute it once. */ if (collation == DEFAULT_COLLATION_OID) { @@ -921,7 +920,7 @@ lc_ctype_is_c(Oid collation) /* - * Create a locale_t from a collation OID. Results are cached for the + * Create a locale_t from a collation OID. Results are cached for the * lifetime of the backend. Thus, do not free the result with freelocale(). * * As a special optimization, the default/database collation returns 0. @@ -987,7 +986,7 @@ pg_newlocale_from_collation(Oid collid) { #ifndef WIN32 /* We need two newlocale() steps */ - locale_t loc1; + locale_t loc1; loc1 = newlocale(LC_COLLATE_MASK, collcollate, NULL); if (!loc1) @@ -1002,10 +1001,11 @@ pg_newlocale_from_collation(Oid collid) errmsg("could not create locale \"%s\": %m", collctype))); #else + /* - * XXX The _create_locale() API doesn't appear to support - * this. Could perhaps be worked around by changing - * pg_locale_t to contain two separate fields. + * XXX The _create_locale() API doesn't appear to support this. + * Could perhaps be worked around by changing pg_locale_t to + * contain two separate fields. */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), @@ -1016,8 +1016,7 @@ pg_newlocale_from_collation(Oid collid) cache_entry->locale = result; ReleaseSysCache(tp); - -#else /* not HAVE_LOCALE_T */ +#else /* not HAVE_LOCALE_T */ /* * For platforms that don't support locale_t, we can't do anything @@ -1025,8 +1024,8 @@ pg_newlocale_from_collation(Oid collid) */ ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("nondefault collations are not supported on this platform"))); -#endif /* not HAVE_LOCALE_T */ + errmsg("nondefault collations are not supported on this platform"))); +#endif /* not HAVE_LOCALE_T */ } return cache_entry->locale; diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c index 137c811bc3a..f811245cea0 100644 --- a/src/backend/utils/adt/pgstatfuncs.c +++ b/src/backend/utils/adt/pgstatfuncs.c @@ -364,7 +364,7 @@ pg_stat_get_vacuum_count(PG_FUNCTION_ARGS) { Oid relid = PG_GETARG_OID(0); int64 result; - PgStat_StatTabEntry *tabentry; + PgStat_StatTabEntry *tabentry; if ((tabentry = pgstat_fetch_stat_tabentry(relid)) == NULL) result = 0; @@ -379,7 +379,7 @@ pg_stat_get_autovacuum_count(PG_FUNCTION_ARGS) { Oid relid = PG_GETARG_OID(0); int64 result; - PgStat_StatTabEntry *tabentry; + PgStat_StatTabEntry *tabentry; if ((tabentry = pgstat_fetch_stat_tabentry(relid)) == NULL) result = 0; @@ -394,7 +394,7 @@ pg_stat_get_analyze_count(PG_FUNCTION_ARGS) { Oid relid = PG_GETARG_OID(0); int64 result; - PgStat_StatTabEntry *tabentry; + PgStat_StatTabEntry *tabentry; if ((tabentry = pgstat_fetch_stat_tabentry(relid)) == NULL) result = 0; @@ -409,7 +409,7 @@ pg_stat_get_autoanalyze_count(PG_FUNCTION_ARGS) { Oid relid = PG_GETARG_OID(0); int64 result; - PgStat_StatTabEntry *tabentry; + PgStat_StatTabEntry *tabentry; if ((tabentry = pgstat_fetch_stat_tabentry(relid)) == NULL) result = 0; @@ -1263,11 +1263,11 @@ pg_stat_get_db_conflict_all(PG_FUNCTION_ARGS) result = 0; else result = (int64) ( - dbentry->n_conflict_tablespace + - dbentry->n_conflict_lock + - dbentry->n_conflict_snapshot + - dbentry->n_conflict_bufferpin + - dbentry->n_conflict_startup_deadlock); + dbentry->n_conflict_tablespace + + dbentry->n_conflict_lock + + dbentry->n_conflict_snapshot + + dbentry->n_conflict_bufferpin + + dbentry->n_conflict_startup_deadlock); PG_RETURN_INT64(result); } diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 591d2eb16b0..84797191efa 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -2608,7 +2608,7 @@ RI_FKey_keyequal_upd_fk(Trigger *trigger, Relation fk_rel, * This is not a trigger procedure, but is called during ALTER TABLE * ADD FOREIGN KEY to validate the initial table contents. * - * We expect that the caller has made provision to prevent any problems + * We expect that the caller has made provision to prevent any problems * caused by concurrent actions. This could be either by locking rel and * pkrel at ShareRowExclusiveLock or higher, or by otherwise ensuring * that triggers implementing the checks are already active. @@ -2629,8 +2629,8 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel) char fkrelname[MAX_QUOTED_REL_NAME_LEN]; char pkattname[MAX_QUOTED_NAME_LEN + 3]; char fkattname[MAX_QUOTED_NAME_LEN + 3]; - RangeTblEntry *pkrte; - RangeTblEntry *fkrte; + RangeTblEntry *pkrte; + RangeTblEntry *fkrte; const char *sep; int i; int old_work_mem; @@ -2662,7 +2662,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel) for (i = 0; i < riinfo.nkeys; i++) { - int attno; + int attno; attno = riinfo.pk_attnums[i] - FirstLowInvalidHeapAttributeNumber; pkrte->selectedCols = bms_add_member(pkrte->selectedCols, attno); @@ -2789,10 +2789,10 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel) /* * Run the plan. For safety we force a current snapshot to be used. (In - * transaction-snapshot mode, this arguably violates transaction - * isolation rules, but we really haven't got much choice.) - * We don't need to register the snapshot, because SPI_execute_snapshot - * will see to it. We need at most one tuple returned, so pass limit = 1. + * transaction-snapshot mode, this arguably violates transaction isolation + * rules, but we really haven't got much choice.) We don't need to + * register the snapshot, because SPI_execute_snapshot will see to it. We + * need at most one tuple returned, so pass limit = 1. */ spi_result = SPI_execute_snapshot(qplan, NULL, NULL, @@ -3337,8 +3337,8 @@ ri_PerformCheck(RI_QueryKey *qkey, SPIPlanPtr qplan, /* * In READ COMMITTED mode, we just need to use an up-to-date regular * snapshot, and we will see all rows that could be interesting. But in - * transaction-snapshot mode, we can't change the transaction snapshot. - * If the caller passes detectNewRows == false then it's okay to do the query + * transaction-snapshot mode, we can't change the transaction snapshot. If + * the caller passes detectNewRows == false then it's okay to do the query * with the transaction snapshot; otherwise we use a current snapshot, and * tell the executor to error out if it finds any rows under the current * snapshot that wouldn't be visible per the transaction snapshot. Note diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 326079a75ba..e436a1ee59f 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -169,11 +169,11 @@ static void set_deparse_planstate(deparse_namespace *dpns, PlanState *ps); static void push_child_plan(deparse_namespace *dpns, PlanState *ps, deparse_namespace *save_dpns); static void pop_child_plan(deparse_namespace *dpns, - deparse_namespace *save_dpns); + deparse_namespace *save_dpns); static void push_ancestor_plan(deparse_namespace *dpns, ListCell *ancestor_cell, deparse_namespace *save_dpns); static void pop_ancestor_plan(deparse_namespace *dpns, - deparse_namespace *save_dpns); + deparse_namespace *save_dpns); static void make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, int prettyFlags); static void make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc, @@ -948,7 +948,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, if (!attrsOnly && (!colno || colno == keyno + 1)) { - Oid indcoll; + Oid indcoll; /* Add collation, if not default for column */ indcoll = indcollation->values[keyno]; @@ -2207,7 +2207,7 @@ set_deparse_planstate(deparse_namespace *dpns, PlanState *ps) * We special-case Append and MergeAppend to pretend that the first child * plan is the OUTER referent; we have to interpret OUTER Vars in their * tlists according to one of the children, and the first one is the most - * natural choice. Likewise special-case ModifyTable to pretend that the + * natural choice. Likewise special-case ModifyTable to pretend that the * first child plan is the OUTER referent; this is to support RETURNING * lists containing references to non-target relations. */ @@ -2263,8 +2263,8 @@ push_child_plan(deparse_namespace *dpns, PlanState *ps, /* * Currently we don't bother to adjust the ancestors list, because an - * OUTER or INNER reference really shouldn't contain any Params that - * would be set by the parent node itself. If we did want to adjust it, + * OUTER or INNER reference really shouldn't contain any Params that would + * be set by the parent node itself. If we did want to adjust it, * lcons'ing dpns->planstate onto dpns->ancestors would be the appropriate * thing --- and pop_child_plan would need to undo the change to the list. */ @@ -3780,8 +3780,8 @@ get_variable(Var *var, int levelsup, bool showstar, deparse_context *context) * subquery's alias, that's not possible for resjunk items since they have * no alias. So in that case, drill down to the subplan and print the * contents of the referenced tlist item. This works because in a plan - * tree, such Vars can only occur in a SubqueryScan or CteScan node, - * and we'll have set dpns->inner_plan to reference the child plan node. + * tree, such Vars can only occur in a SubqueryScan or CteScan node, and + * we'll have set dpns->inner_plan to reference the child plan node. */ if ((rte->rtekind == RTE_SUBQUERY || rte->rtekind == RTE_CTE) && attnum > list_length(rte->eref->colnames) && @@ -4145,7 +4145,7 @@ get_name_for_var_field(Var *var, int fieldno, if (lc != NULL) { Query *ctequery = (Query *) cte->ctequery; - TargetEntry *ste = get_tle_by_resno(GetCTETargetList(cte), + TargetEntry *ste = get_tle_by_resno(GetCTETargetList(cte), attnum); if (ste == NULL || ste->resjunk) @@ -4279,11 +4279,11 @@ static void get_parameter(Param *param, deparse_context *context) { /* - * If it's a PARAM_EXEC parameter, try to locate the expression from - * which the parameter was computed. This will necessarily be in some - * ancestor of the current expression's PlanState. Note that failing - * to find a referent isn't an error, since the Param might well be a - * subplan output rather than an input. + * If it's a PARAM_EXEC parameter, try to locate the expression from which + * the parameter was computed. This will necessarily be in some ancestor + * of the current expression's PlanState. Note that failing to find a + * referent isn't an error, since the Param might well be a subplan output + * rather than an input. */ if (param->paramkind == PARAM_EXEC) { @@ -4302,9 +4302,9 @@ get_parameter(Param *param, deparse_context *context) ListCell *lc2; /* - * NestLoops transmit params to their inner child only; also, - * once we've crawled up out of a subplan, this couldn't - * possibly be the right match. + * NestLoops transmit params to their inner child only; also, once + * we've crawled up out of a subplan, this couldn't possibly be + * the right match. */ if (IsA(ps, NestLoopState) && child_ps == innerPlanState(ps) && @@ -4314,7 +4314,7 @@ get_parameter(Param *param, deparse_context *context) foreach(lc2, nl->nestParams) { - NestLoopParam *nlp = (NestLoopParam *) lfirst(lc2); + NestLoopParam *nlp = (NestLoopParam *) lfirst(lc2); if (nlp->paramno == param->paramid) { @@ -4342,8 +4342,8 @@ get_parameter(Param *param, deparse_context *context) /* Matched subplan, so check its arguments */ forboth(lc3, subplan->parParam, lc4, subplan->args) { - int paramid = lfirst_int(lc3); - Node *arg = (Node *) lfirst(lc4); + int paramid = lfirst_int(lc3); + Node *arg = (Node *) lfirst(lc4); if (paramid == param->paramid) { @@ -4898,7 +4898,7 @@ get_rule_expr(Node *node, deparse_context *context, appendStringInfo(buf, " %s %s (", generate_operator_name(expr->opno, exprType(arg1), - get_base_element_type(exprType(arg2))), + get_base_element_type(exprType(arg2))), expr->useOr ? "ANY" : "ALL"); get_rule_expr_paren(arg2, context, true, node); appendStringInfoChar(buf, ')'); @@ -6126,7 +6126,7 @@ get_const_collation(Const *constval, deparse_context *context) if (OidIsValid(constval->constcollid)) { - Oid typcollation = get_typcollation(constval->consttype); + Oid typcollation = get_typcollation(constval->consttype); if (constval->constcollid != typcollation) { @@ -6384,7 +6384,7 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context) gavealias = true; } else if (rte->rtekind == RTE_RELATION && - strcmp(rte->eref->aliasname, get_relation_name(rte->relid)) != 0) + strcmp(rte->eref->aliasname, get_relation_name(rte->relid)) != 0) { /* * Apparently the rel has been renamed since the rule was made. diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 092dc15a02b..41c5202146d 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -6329,28 +6329,28 @@ gincostestimate(PG_FUNCTION_ARGS) Cost *indexTotalCost = (Cost *) PG_GETARG_POINTER(6); Selectivity *indexSelectivity = (Selectivity *) PG_GETARG_POINTER(7); double *indexCorrelation = (double *) PG_GETARG_POINTER(8); - ListCell *l; - List *selectivityQuals; - double numPages = index->pages, - numTuples = index->tuples; - double numEntryPages, - numDataPages, - numPendingPages, - numEntries; - bool haveFullScan = false; - double partialEntriesInQuals = 0.0; - double searchEntriesInQuals = 0.0; - double exactEntriesInQuals = 0.0; - double entryPagesFetched, - dataPagesFetched, - dataPagesFetchedBySel; - double qual_op_cost, - qual_arg_cost, - spc_random_page_cost, - num_scans; - QualCost index_qual_cost; - Relation indexRel; - GinStatsData ginStats; + ListCell *l; + List *selectivityQuals; + double numPages = index->pages, + numTuples = index->tuples; + double numEntryPages, + numDataPages, + numPendingPages, + numEntries; + bool haveFullScan = false; + double partialEntriesInQuals = 0.0; + double searchEntriesInQuals = 0.0; + double exactEntriesInQuals = 0.0; + double entryPagesFetched, + dataPagesFetched, + dataPagesFetchedBySel; + double qual_op_cost, + qual_arg_cost, + spc_random_page_cost, + num_scans; + QualCost index_qual_cost; + Relation indexRel; + GinStatsData ginStats; /* * Obtain statistic information from the meta page @@ -6366,7 +6366,7 @@ gincostestimate(PG_FUNCTION_ARGS) /* * nPendingPages can be trusted, but the other fields are as of the last - * VACUUM. Scale them by the ratio numPages / nTotalPages to account for + * VACUUM. Scale them by the ratio numPages / nTotalPages to account for * growth since then. If the fields are zero (implying no VACUUM at all, * and an index created pre-9.1), assume all pages are entry pages. */ @@ -6374,11 +6374,11 @@ gincostestimate(PG_FUNCTION_ARGS) { numEntryPages = numPages; numDataPages = 0; - numEntries = numTuples; /* bogus, but no other info available */ + numEntries = numTuples; /* bogus, but no other info available */ } else { - double scale = numPages / ginStats.nTotalPages; + double scale = numPages / ginStats.nTotalPages; numEntryPages = ceil(numEntryPages * scale); numDataPages = ceil(numDataPages * scale); @@ -6389,7 +6389,8 @@ gincostestimate(PG_FUNCTION_ARGS) } /* - * Include predicate in selectivityQuals (should match genericcostestimate) + * Include predicate in selectivityQuals (should match + * genericcostestimate) */ if (index->indpred != NIL) { @@ -6411,12 +6412,12 @@ gincostestimate(PG_FUNCTION_ARGS) /* Estimate the fraction of main-table tuples that will be visited */ *indexSelectivity = clauselist_selectivity(root, selectivityQuals, - index->rel->relid, - JOIN_INNER, - NULL); + index->rel->relid, + JOIN_INNER, + NULL); /* fetch estimated page cost for schema containing index */ - get_tablespace_page_costs(index->reltablespace, + get_tablespace_page_costs(index->reltablespace, &spc_random_page_cost, NULL); @@ -6430,22 +6431,22 @@ gincostestimate(PG_FUNCTION_ARGS) */ foreach(l, indexQuals) { - RestrictInfo *rinfo = (RestrictInfo *) lfirst(l); - Expr *clause; - Node *leftop, - *rightop, - *operand; - Oid extractProcOid; - Oid clause_op; - int strategy_op; - Oid lefttype, - righttype; - int32 nentries = 0; - bool *partial_matches = NULL; - Pointer *extra_data = NULL; - bool *nullFlags = NULL; - int32 searchMode = GIN_SEARCH_MODE_DEFAULT; - int indexcol; + RestrictInfo *rinfo = (RestrictInfo *) lfirst(l); + Expr *clause; + Node *leftop, + *rightop, + *operand; + Oid extractProcOid; + Oid clause_op; + int strategy_op; + Oid lefttype, + righttype; + int32 nentries = 0; + bool *partial_matches = NULL; + Pointer *extra_data = NULL; + bool *nullFlags = NULL; + int32 searchMode = GIN_SEARCH_MODE_DEFAULT; + int indexcol; Assert(IsA(rinfo, RestrictInfo)); clause = rinfo->clause; @@ -6466,16 +6467,16 @@ gincostestimate(PG_FUNCTION_ARGS) else { elog(ERROR, "could not match index to operand"); - operand = NULL; /* keep compiler quiet */ + operand = NULL; /* keep compiler quiet */ } if (IsA(operand, RelabelType)) operand = (Node *) ((RelabelType *) operand)->arg; /* - * It's impossible to call extractQuery method for unknown operand. - * So unless operand is a Const we can't do much; just assume there - * will be one ordinary search entry from the operand at runtime. + * It's impossible to call extractQuery method for unknown operand. So + * unless operand is a Const we can't do much; just assume there will + * be one ordinary search entry from the operand at runtime. */ if (!IsA(operand, Const)) { @@ -6484,7 +6485,7 @@ gincostestimate(PG_FUNCTION_ARGS) } /* If Const is null, there can be no matches */ - if (((Const*) operand)->constisnull) + if (((Const *) operand)->constisnull) { *indexStartupCost = 0; *indexTotalCost = 0; @@ -6494,9 +6495,9 @@ gincostestimate(PG_FUNCTION_ARGS) /* * Get the operator's strategy number and declared input data types - * within the index opfamily. (We don't need the latter, but we - * use get_op_opfamily_properties because it will throw error if - * it fails to find a matching pg_amop entry.) + * within the index opfamily. (We don't need the latter, but we use + * get_op_opfamily_properties because it will throw error if it fails + * to find a matching pg_amop entry.) */ get_op_opfamily_properties(clause_op, index->opfamily[indexcol], false, &strategy_op, &lefttype, &righttype); @@ -6515,12 +6516,12 @@ gincostestimate(PG_FUNCTION_ARGS) { /* should not happen; throw same error as index_getprocinfo */ elog(ERROR, "missing support function %d for attribute %d of index \"%s\"", - GIN_EXTRACTQUERY_PROC, indexcol+1, + GIN_EXTRACTQUERY_PROC, indexcol + 1, get_rel_name(index->indexoid)); } OidFunctionCall7(extractProcOid, - ((Const*) operand)->constvalue, + ((Const *) operand)->constvalue, PointerGetDatum(&nentries), UInt16GetDatum(strategy_op), PointerGetDatum(&partial_matches), @@ -6538,9 +6539,9 @@ gincostestimate(PG_FUNCTION_ARGS) } else { - int32 i; + int32 i; - for (i=0; i<nentries; i++) + for (i = 0; i < nentries; i++) { /* * For partial match we haven't any information to estimate @@ -6585,32 +6586,30 @@ gincostestimate(PG_FUNCTION_ARGS) num_scans = 1; /* - * cost to begin scan, first of all, pay attention to - * pending list. + * cost to begin scan, first of all, pay attention to pending list. */ entryPagesFetched = numPendingPages; /* * Estimate number of entry pages read. We need to do * searchEntriesInQuals searches. Use a power function as it should be, - * but tuples on leaf pages usually is much greater. - * Here we include all searches in entry tree, including - * search of first entry in partial match algorithm + * but tuples on leaf pages usually is much greater. Here we include all + * searches in entry tree, including search of first entry in partial + * match algorithm */ entryPagesFetched += ceil(searchEntriesInQuals * rint(pow(numEntryPages, 0.15))); /* - * Add an estimate of entry pages read by partial match algorithm. - * It's a scan over leaf pages in entry tree. We haven't any useful stats - * here, so estimate it as proportion. + * Add an estimate of entry pages read by partial match algorithm. It's a + * scan over leaf pages in entry tree. We haven't any useful stats here, + * so estimate it as proportion. */ entryPagesFetched += ceil(numEntryPages * partialEntriesInQuals / numEntries); /* - * Partial match algorithm reads all data pages before - * doing actual scan, so it's a startup cost. Again, - * we havn't any useful stats here, so, estimate it as - * proportion + * Partial match algorithm reads all data pages before doing actual scan, + * so it's a startup cost. Again, we havn't any useful stats here, so, + * estimate it as proportion */ dataPagesFetched = ceil(numDataPages * partialEntriesInQuals / numEntries); @@ -6626,8 +6625,8 @@ gincostestimate(PG_FUNCTION_ARGS) } /* - * Here we use random page cost because logically-close pages could be - * far apart on disk. + * Here we use random page cost because logically-close pages could be far + * apart on disk. */ *indexStartupCost = (entryPagesFetched + dataPagesFetched) * spc_random_page_cost; @@ -6639,16 +6638,16 @@ gincostestimate(PG_FUNCTION_ARGS) * capacity of data page. */ dataPagesFetchedBySel = ceil(*indexSelectivity * - (numTuples / (BLCKSZ/SizeOfIptrData))); + (numTuples / (BLCKSZ / SizeOfIptrData))); if (dataPagesFetchedBySel > dataPagesFetched) { /* - * At least one of entries is very frequent and, unfortunately, - * we couldn't get statistic about entries (only tsvector has - * such statistics). So, we obviously have too small estimation of - * pages fetched from data tree. Re-estimate it from known - * capacity of data pages + * At least one of entries is very frequent and, unfortunately, we + * couldn't get statistic about entries (only tsvector has such + * statistics). So, we obviously have too small estimation of pages + * fetched from data tree. Re-estimate it from known capacity of data + * pages */ dataPagesFetched = dataPagesFetchedBySel; } @@ -6670,7 +6669,7 @@ gincostestimate(PG_FUNCTION_ARGS) qual_op_cost = cpu_operator_cost * (list_length(indexQuals) + list_length(indexOrderBys)); qual_arg_cost -= qual_op_cost; - if (qual_arg_cost < 0) /* just in case... */ + if (qual_arg_cost < 0) /* just in case... */ qual_arg_cost = 0; *indexStartupCost += qual_arg_cost; diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c index 41700bfcf15..4cb961146b8 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -95,10 +95,12 @@ gin_extract_tsquery(PG_FUNCTION_ARGS) { TSQuery query = PG_GETARG_TSQUERY(0); int32 *nentries = (int32 *) PG_GETARG_POINTER(1); + /* StrategyNumber strategy = PG_GETARG_UINT16(2); */ bool **ptr_partialmatch = (bool **) PG_GETARG_POINTER(3); Pointer **extra_data = (Pointer **) PG_GETARG_POINTER(4); - /* bool **nullFlags = (bool **) PG_GETARG_POINTER(5); */ + + /* bool **nullFlags = (bool **) PG_GETARG_POINTER(5); */ int32 *searchMode = (int32 *) PG_GETARG_POINTER(6); Datum *entries = NULL; @@ -114,8 +116,8 @@ gin_extract_tsquery(PG_FUNCTION_ARGS) /* * If the query doesn't have any required positive matches (for - * instance, it's something like '! foo'), we have to do a full - * index scan. + * instance, it's something like '! foo'), we have to do a full index + * scan. */ if (tsquery_requires_match(item)) *searchMode = GIN_SEARCH_MODE_DEFAULT; @@ -235,7 +237,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS) * Formerly, gin_extract_tsvector had only two arguments. Now it has three, * but we still need a pg_proc entry with two args to support reloading * pre-9.1 contrib/tsearch2 opclass declarations. This compatibility - * function should go away eventually. (Note: you might say "hey, but the + * function should go away eventually. (Note: you might say "hey, but the * code above is only *using* two args, so let's just declare it that way". * If you try that you'll find the opr_sanity regression test complains.) */ diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index b7a822d3544..66674917f0d 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -711,6 +711,7 @@ tsquery_requires_match(QueryItem *curitem) switch (curitem->qoperator.oper) { case OP_NOT: + /* * Assume there are no required matches underneath a NOT. For * some cases with nested NOTs, we could prove there's a required diff --git a/src/backend/utils/adt/varbit.c b/src/backend/utils/adt/varbit.c index 0eb6071e123..3fa81175fd8 100644 --- a/src/backend/utils/adt/varbit.c +++ b/src/backend/utils/adt/varbit.c @@ -237,6 +237,7 @@ bit_out(PG_FUNCTION_ARGS) /* same as varbit output */ return varbit_out(fcinfo); #else + /* * This is how one would print a hex string, in case someone wants to * write a formatting function. diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index 7a545214755..9d96013d57e 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -81,7 +81,7 @@ void text_format_string_conversion(StringInfo buf, char conversion, static Datum text_to_array_internal(PG_FUNCTION_ARGS); static text *array_to_text_internal(FunctionCallInfo fcinfo, ArrayType *v, - char *fldsep, char *null_string); + char *fldsep, char *null_string); /***************************************************************************** @@ -1299,7 +1299,7 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid) char a2buf[STACKBUFLEN]; char *a1p, *a2p; - pg_locale_t mylocale = 0; + pg_locale_t mylocale = 0; if (collid != DEFAULT_COLLATION_OID) { @@ -1379,7 +1379,7 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid) result = wcscoll_l((LPWSTR) a1p, (LPWSTR) a2p, mylocale); else #endif - result = wcscoll((LPWSTR) a1p, (LPWSTR) a2p); + result = wcscoll((LPWSTR) a1p, (LPWSTR) a2p); if (result == 2147483647) /* _NLSCMPERROR; missing from mingw * headers */ ereport(ERROR, @@ -1426,7 +1426,7 @@ varstr_cmp(char *arg1, int len1, char *arg2, int len2, Oid collid) result = strcoll_l(a1p, a2p, mylocale); else #endif - result = strcoll(a1p, a2p); + result = strcoll(a1p, a2p); /* * In some locales strcoll() can claim that nonidentical strings are @@ -1487,10 +1487,10 @@ texteq(PG_FUNCTION_ARGS) /* * Since we only care about equality or not-equality, we can avoid all the - * expense of strcoll() here, and just do bitwise comparison. In fact, - * we don't even have to do a bitwise comparison if we can show the - * lengths of the strings are unequal; which might save us from having - * to detoast one or both values. + * expense of strcoll() here, and just do bitwise comparison. In fact, we + * don't even have to do a bitwise comparison if we can show the lengths + * of the strings are unequal; which might save us from having to detoast + * one or both values. */ len1 = toast_raw_datum_size(arg1); len2 = toast_raw_datum_size(arg2); @@ -2031,7 +2031,7 @@ byteaGetByte(PG_FUNCTION_ARGS) bytea *v = PG_GETARG_BYTEA_PP(0); int32 n = PG_GETARG_INT32(1); int len; - int byte; + int byte; len = VARSIZE_ANY_EXHDR(v); @@ -2062,7 +2062,7 @@ byteaGetBit(PG_FUNCTION_ARGS) int byteNo, bitNo; int len; - int byte; + int byte; len = VARSIZE_ANY_EXHDR(v); @@ -2077,7 +2077,7 @@ byteaGetBit(PG_FUNCTION_ARGS) byte = ((unsigned char *) VARDATA_ANY(v))[byteNo]; - if (byte &(1 << bitNo)) + if (byte & (1 << bitNo)) PG_RETURN_INT32(1); else PG_RETURN_INT32(0); @@ -3144,7 +3144,7 @@ text_to_array_internal(PG_FUNCTION_ARGS) /* single element can be a NULL too */ is_null = null_string ? text_isequal(inputstring, null_string) : false; PG_RETURN_ARRAYTYPE_P(create_singleton_array(fcinfo, TEXTOID, - PointerGetDatum(inputstring), + PointerGetDatum(inputstring), is_null, 1)); } @@ -3152,7 +3152,7 @@ text_to_array_internal(PG_FUNCTION_ARGS) /* start_ptr points to the start_posn'th character of inputstring */ start_ptr = VARDATA_ANY(inputstring); - for (fldnum = 1;; fldnum++) /* field number is 1 based */ + for (fldnum = 1;; fldnum++) /* field number is 1 based */ { CHECK_FOR_INTERRUPTS(); @@ -3197,8 +3197,8 @@ text_to_array_internal(PG_FUNCTION_ARGS) { /* * When fldsep is NULL, each character in the inputstring becomes an - * element in the result array. The separator is effectively the space - * between characters. + * element in the result array. The separator is effectively the + * space between characters. */ inputstring_len = VARSIZE_ANY_EXHDR(inputstring); @@ -3210,7 +3210,7 @@ text_to_array_internal(PG_FUNCTION_ARGS) while (inputstring_len > 0) { - int chunk_len = pg_mblen(start_ptr); + int chunk_len = pg_mblen(start_ptr); CHECK_FOR_INTERRUPTS(); @@ -3625,9 +3625,9 @@ string_agg_finalfn(PG_FUNCTION_ARGS) static text * concat_internal(const char *sepstr, int seplen, int argidx, FunctionCallInfo fcinfo) { - StringInfoData str; - text *result; - int i; + StringInfoData str; + text *result; + int i; initStringInfo(&str); @@ -3635,10 +3635,10 @@ concat_internal(const char *sepstr, int seplen, int argidx, FunctionCallInfo fci { if (!PG_ARGISNULL(i)) { - Oid valtype; - Datum value; - Oid typOutput; - bool typIsVarlena; + Oid valtype; + Datum value; + Oid typOutput; + bool typIsVarlena; if (i > argidx) appendBinaryStringInfo(&str, sepstr, seplen); @@ -3648,7 +3648,7 @@ concat_internal(const char *sepstr, int seplen, int argidx, FunctionCallInfo fci valtype = get_fn_expr_argtype(fcinfo->flinfo, i); getTypeOutputInfo(valtype, &typOutput, &typIsVarlena); appendStringInfoString(&str, - OidOutputFunctionCall(typOutput, value)); + OidOutputFunctionCall(typOutput, value)); } } @@ -3674,7 +3674,7 @@ text_concat(PG_FUNCTION_ARGS) Datum text_concat_ws(PG_FUNCTION_ARGS) { - text *sep; + text *sep; /* return NULL when separator is NULL */ if (PG_ARGISNULL(0)) @@ -3683,7 +3683,7 @@ text_concat_ws(PG_FUNCTION_ARGS) sep = PG_GETARG_TEXT_PP(0); PG_RETURN_TEXT_P(concat_internal( - VARDATA_ANY(sep), VARSIZE_ANY_EXHDR(sep), 1, fcinfo)); + VARDATA_ANY(sep), VARSIZE_ANY_EXHDR(sep), 1, fcinfo)); } /* @@ -3734,15 +3734,15 @@ text_right(PG_FUNCTION_ARGS) Datum text_reverse(PG_FUNCTION_ARGS) { - text *str = PG_GETARG_TEXT_PP(0); - const char *p = VARDATA_ANY(str); - int len = VARSIZE_ANY_EXHDR(str); - const char *endp = p + len; - text *result; - char *dst; + text *str = PG_GETARG_TEXT_PP(0); + const char *p = VARDATA_ANY(str); + int len = VARSIZE_ANY_EXHDR(str); + const char *endp = p + len; + text *result; + char *dst; result = palloc(len + VARHDRSZ); - dst = (char*) VARDATA(result) + len; + dst = (char *) VARDATA(result) + len; SET_VARSIZE(result, len + VARHDRSZ); if (pg_database_encoding_max_length() > 1) @@ -3750,7 +3750,7 @@ text_reverse(PG_FUNCTION_ARGS) /* multibyte version */ while (p < endp) { - int sz; + int sz; sz = pg_mblen(p); dst -= sz; @@ -3775,7 +3775,7 @@ Datum text_format(PG_FUNCTION_ARGS) { text *fmt; - StringInfoData str; + StringInfoData str; const char *cp; const char *start_ptr; const char *end_ptr; @@ -3795,9 +3795,9 @@ text_format(PG_FUNCTION_ARGS) /* Scan format string, looking for conversion specifiers. */ for (cp = start_ptr; cp < end_ptr; cp++) { - Datum value; - bool isNull; - Oid typid; + Datum value; + bool isNull; + Oid typid; /* * If it's not the start of a conversion specifier, just copy it to @@ -3830,11 +3830,12 @@ text_format(PG_FUNCTION_ARGS) ++arg; else { - bool unterminated = false; + bool unterminated = false; /* Parse digit string. */ arg = 0; - do { + do + { /* Treat overflowing arg position as unterminated. */ if (arg > INT_MAX / 10) break; @@ -3863,8 +3864,8 @@ text_format(PG_FUNCTION_ARGS) /* There's no argument 0. */ if (arg == 0) ereport(ERROR, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("conversion specifies argument 0, but arguments are numbered from 1"))); + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("conversion specifies argument 0, but arguments are numbered from 1"))); } /* Not enough arguments? Deduct 1 to avoid counting format string. */ @@ -3874,9 +3875,9 @@ text_format(PG_FUNCTION_ARGS) errmsg("too few arguments for format conversion"))); /* - * At this point, we should see the main conversion specifier. - * Whether or not an argument position was present, it's known - * that at least one character remains in the string at this point. + * At this point, we should see the main conversion specifier. Whether + * or not an argument position was present, it's known that at least + * one character remains in the string at this point. */ value = PG_GETARG_DATUM(arg); isNull = PG_ARGISNULL(arg); @@ -3893,7 +3894,7 @@ text_format(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("unrecognized conversion specifier: %c", - *cp))); + *cp))); } } @@ -3907,11 +3908,11 @@ text_format(PG_FUNCTION_ARGS) /* Format a %s, %I, or %L conversion. */ void text_format_string_conversion(StringInfo buf, char conversion, - Oid typid, Datum value, bool isNull) + Oid typid, Datum value, bool isNull) { - Oid typOutput; - bool typIsVarlena; - char *str; + Oid typOutput; + bool typIsVarlena; + char *str; /* Handle NULL arguments before trying to stringify the value. */ if (isNull) @@ -3919,7 +3920,7 @@ text_format_string_conversion(StringInfo buf, char conversion, if (conversion == 'L') appendStringInfoString(buf, "NULL"); else if (conversion == 'I') - ereport(ERROR, + ereport(ERROR, (errcode(ERRCODE_NULL_VALUE_NOT_ALLOWED), errmsg("NULL cannot be escaped as an SQL identifier"))); return; @@ -3937,7 +3938,8 @@ text_format_string_conversion(StringInfo buf, char conversion, } else if (conversion == 'L') { - char *qstr = quote_literal_cstr(str); + char *qstr = quote_literal_cstr(str); + appendStringInfoString(buf, qstr); /* quote_literal_cstr() always allocates a new string */ pfree(qstr); @@ -3951,7 +3953,7 @@ text_format_string_conversion(StringInfo buf, char conversion, /* * text_format_nv - nonvariadic wrapper for text_format function. - * + * * note: this wrapper is necessary to be sanity_checks test ok */ Datum diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index c175e4f4cac..ee82d4616c6 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -1200,9 +1200,10 @@ xml_parse(text *data, XmlOptionType xmloption_arg, bool preserve_whitespace, { /* * Note, that here we try to apply DTD defaults - * (XML_PARSE_DTDATTR) according to SQL/XML:2008 GR 10.16.7.d: 'Default - * values defined by internal DTD are applied'. As for external - * DTDs, we try to support them too, (see SQL/XML:2008 GR 10.16.7.e) + * (XML_PARSE_DTDATTR) according to SQL/XML:2008 GR 10.16.7.d: + * 'Default values defined by internal DTD are applied'. As for + * external DTDs, we try to support them too, (see SQL/XML:2008 GR + * 10.16.7.e) */ doc = xmlCtxtReadDoc(ctxt, utf8string, NULL, @@ -3435,10 +3436,10 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces, /* * Version 2.6.27 introduces a function named - * xmlXPathCompiledEvalToBoolean, which would be enough for - * xmlexists, but we can derive the existence by whether any - * nodes are returned, thereby preventing a library version - * upgrade and keeping the code the same. + * xmlXPathCompiledEvalToBoolean, which would be enough for xmlexists, + * but we can derive the existence by whether any nodes are returned, + * thereby preventing a library version upgrade and keeping the code + * the same. */ xpathobj = xmlXPathCompiledEval(xpathcomp, xpathctx); if (xpathobj == NULL) /* TODO: reason? */ @@ -3488,7 +3489,7 @@ xpath_internal(text *xpath_expr_text, xmltype *data, ArrayType *namespaces, xmlFreeDoc(doc); xmlFreeParserCtxt(ctxt); } -#endif /* USE_LIBXML */ +#endif /* USE_LIBXML */ /* * Evaluate XPath expression and return array of XML values. @@ -3524,7 +3525,8 @@ xpath(PG_FUNCTION_ARGS) * Determines if the node specified by the supplied XPath exists * in a given XML document, returning a boolean. */ -Datum xmlexists(PG_FUNCTION_ARGS) +Datum +xmlexists(PG_FUNCTION_ARGS) { #ifdef USE_LIBXML text *xpath_expr_text = PG_GETARG_TEXT_P(0); diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index fe89b71df2d..ebc83440dea 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -514,7 +514,8 @@ LocalExecuteInvalidationMessage(SharedInvalidationMessage *msg) * We could have smgr entries for relations of other databases, so no * short-circuit test is possible here. */ - RelFileNodeBackend rnode; + RelFileNodeBackend rnode; + rnode.node = msg->sm.rnode; rnode.backend = (msg->sm.backend_hi << 16) | (int) msg->sm.backend_lo; smgrclosenode(rnode); diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 877e50d8737..d3b2a5a5572 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -1122,7 +1122,7 @@ op_input_types(Oid opno, Oid *lefttype, Oid *righttype) * * In some cases (currently only array_eq), mergejoinability depends on the * specific input data type the operator is invoked for, so that must be - * passed as well. We currently assume that only one input's type is needed + * passed as well. We currently assume that only one input's type is needed * to check this --- by convention, pass the left input's data type. */ bool @@ -1172,7 +1172,7 @@ op_mergejoinable(Oid opno, Oid inputtype) * * In some cases (currently only array_eq), hashjoinability depends on the * specific input data type the operator is invoked for, so that must be - * passed as well. We currently assume that only one input's type is needed + * passed as well. We currently assume that only one input's type is needed * to check this --- by convention, pass the left input's data type. */ bool @@ -2709,9 +2709,9 @@ get_attstatsslot(HeapTuple statstuple, /* * Need to get info about the array element type. We look at the * actual element type embedded in the array, which might be only - * binary-compatible with the passed-in atttype. The info we - * extract here should be the same either way, but deconstruct_array - * is picky about having an exact type OID match. + * binary-compatible with the passed-in atttype. The info we extract + * here should be the same either way, but deconstruct_array is picky + * about having an exact type OID match. */ arrayelemtype = ARR_ELEMTYPE(statarray); typeTuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(arrayelemtype)); diff --git a/src/backend/utils/cache/plancache.c b/src/backend/utils/cache/plancache.c index 949608001ea..08ddfa9bcba 100644 --- a/src/backend/utils/cache/plancache.c +++ b/src/backend/utils/cache/plancache.c @@ -512,8 +512,8 @@ RevalidateCachedPlan(CachedPlanSource *plansource, bool useResOwner) TupleDesc resultDesc; /* - * Restore the search_path that was in use when the plan was made. - * See comments for PushOverrideSearchPath about limitations of this. + * Restore the search_path that was in use when the plan was made. See + * comments for PushOverrideSearchPath about limitations of this. * * (XXX is there anything else we really need to restore?) */ diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 274b48c8951..d7e94ffc125 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -1070,9 +1070,9 @@ RelationInitIndexAccessInfo(Relation relation) MemoryContextAllocZero(indexcxt, natts * sizeof(int16)); /* - * indcollation cannot be referenced directly through the C struct, because it - * comes after the variable-width indkey field. Must extract the datum - * the hard way... + * indcollation cannot be referenced directly through the C struct, + * because it comes after the variable-width indkey field. Must extract + * the datum the hard way... */ indcollDatum = fastgetattr(relation->rd_indextuple, Anum_pg_index_indcollation, @@ -1096,7 +1096,7 @@ RelationInitIndexAccessInfo(Relation relation) /* * Fill the support procedure OID array, as well as the info about - * opfamilies and opclass input types. (aminfo and supportinfo are left + * opfamilies and opclass input types. (aminfo and supportinfo are left * as zeroes, and are filled on-the-fly when used) */ IndexSupportInitialize(indclass, relation->rd_support, diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c index 715341f8420..2b5e37e2f05 100644 --- a/src/backend/utils/cache/syscache.c +++ b/src/backend/utils/cache/syscache.c @@ -422,7 +422,7 @@ static const struct cachedesc cacheinfo[] = { }, 32 }, - {ForeignTableRelationId, /* FOREIGNTABLEREL */ + {ForeignTableRelationId, /* FOREIGNTABLEREL */ ForeignTableRelidIndexId, 1, { diff --git a/src/backend/utils/cache/ts_cache.c b/src/backend/utils/cache/ts_cache.c index fc93551d069..a8c4d76565a 100644 --- a/src/backend/utils/cache/ts_cache.c +++ b/src/backend/utils/cache/ts_cache.c @@ -582,7 +582,7 @@ getTSCurrentConfig(bool emitError) /* Look up the config */ TSCurrentConfigCache = get_ts_config_oid(stringToQualifiedNameList(TSCurrentConfig), - !emitError); + !emitError); return TSCurrentConfigCache; } diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c index 54e1942c319..2769a30acd8 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -77,7 +77,7 @@ typedef struct TypeCacheEnumData Oid bitmap_base; /* OID corresponding to bit 0 of bitmapset */ Bitmapset *sorted_values; /* Set of OIDs known to be in order */ int num_values; /* total number of values in enum */ - EnumItem enum_values[1]; /* VARIABLE LENGTH ARRAY */ + EnumItem enum_values[1]; /* VARIABLE LENGTH ARRAY */ } TypeCacheEnumData; /* @@ -227,10 +227,10 @@ lookup_type_cache(Oid type_id, int flags) { /* * In case we find a btree opclass where previously we only found - * a hash opclass, reset eq_opr and derived information so that - * we can fetch the btree equality operator instead of the hash - * equality operator. (They're probably the same operator, but - * we don't assume that here.) + * a hash opclass, reset eq_opr and derived information so that we + * can fetch the btree equality operator instead of the hash + * equality operator. (They're probably the same operator, but we + * don't assume that here.) */ typentry->eq_opr = InvalidOid; typentry->eq_opr_finfo.fn_oid = InvalidOid; @@ -612,7 +612,8 @@ TypeCacheRelCallback(Datum arg, Oid relid) while ((typentry = (TypeCacheEntry *) hash_seq_search(&status)) != NULL) { if (typentry->tupDesc == NULL) - continue; /* not composite, or tupdesc hasn't been requested */ + continue; /* not composite, or tupdesc hasn't been + * requested */ /* Delete if match, or if we're zapping all composite types */ if (relid == typentry->typrelid || relid == InvalidOid) @@ -671,8 +672,8 @@ compare_values_of_enum(TypeCacheEntry *tcache, Oid arg1, Oid arg2) EnumItem *item2; /* - * Equal OIDs are certainly equal --- this case was probably handled - * by our caller, but we may as well check. + * Equal OIDs are certainly equal --- this case was probably handled by + * our caller, but we may as well check. */ if (arg1 == arg2) return 0; @@ -704,8 +705,8 @@ compare_values_of_enum(TypeCacheEntry *tcache, Oid arg1, Oid arg2) { /* * We couldn't find one or both values. That means the enum has - * changed under us, so re-initialize the cache and try again. - * We don't bother retrying the known-sorted case in this path. + * changed under us, so re-initialize the cache and try again. We + * don't bother retrying the known-sorted case in this path. */ load_enum_cache_data(tcache); enumdata = tcache->enumData; @@ -714,8 +715,8 @@ compare_values_of_enum(TypeCacheEntry *tcache, Oid arg1, Oid arg2) item2 = find_enumitem(enumdata, arg2); /* - * If we still can't find the values, complain: we must have - * corrupt data. + * If we still can't find the values, complain: we must have corrupt + * data. */ if (item1 == NULL) elog(ERROR, "enum value %u not found in cache for enum %s", @@ -761,21 +762,21 @@ load_enum_cache_data(TypeCacheEntry *tcache) format_type_be(tcache->type_id)))); /* - * Read all the information for members of the enum type. We collect - * the info in working memory in the caller's context, and then transfer - * it to permanent memory in CacheMemoryContext. This minimizes the risk - * of leaking memory from CacheMemoryContext in the event of an error - * partway through. + * Read all the information for members of the enum type. We collect the + * info in working memory in the caller's context, and then transfer it to + * permanent memory in CacheMemoryContext. This minimizes the risk of + * leaking memory from CacheMemoryContext in the event of an error partway + * through. */ maxitems = 64; items = (EnumItem *) palloc(sizeof(EnumItem) * maxitems); numitems = 0; /* - * Scan pg_enum for the members of the target enum type. We use a - * current MVCC snapshot, *not* SnapshotNow, so that we see a consistent - * set of rows even if someone commits a renumbering of the enum meanwhile. - * See comments for RenumberEnumType in catalog/pg_enum.c for more info. + * Scan pg_enum for the members of the target enum type. We use a current + * MVCC snapshot, *not* SnapshotNow, so that we see a consistent set of + * rows even if someone commits a renumbering of the enum meanwhile. See + * comments for RenumberEnumType in catalog/pg_enum.c for more info. */ ScanKeyInit(&skey, Anum_pg_enum_enumtypid, @@ -817,8 +818,8 @@ load_enum_cache_data(TypeCacheEntry *tcache) * and we'd rather not do binary searches unnecessarily. * * This is somewhat heuristic, and might identify a subset of OIDs that - * isn't exactly what the type started with. That's okay as long as - * the subset is correctly sorted. + * isn't exactly what the type started with. That's okay as long as the + * subset is correctly sorted. */ bitmap_base = InvalidOid; bitmap = NULL; @@ -829,15 +830,15 @@ load_enum_cache_data(TypeCacheEntry *tcache) /* * Identify longest sorted subsequence starting at start_pos */ - Bitmapset *this_bitmap = bms_make_singleton(0); - int this_bm_size = 1; - Oid start_oid = items[start_pos].enum_oid; - float4 prev_order = items[start_pos].sort_order; - int i; + Bitmapset *this_bitmap = bms_make_singleton(0); + int this_bm_size = 1; + Oid start_oid = items[start_pos].enum_oid; + float4 prev_order = items[start_pos].sort_order; + int i; for (i = start_pos + 1; i < numitems; i++) { - Oid offset; + Oid offset; offset = items[i].enum_oid - start_oid; /* quit if bitmap would be too large; cutoff is arbitrary */ @@ -864,10 +865,10 @@ load_enum_cache_data(TypeCacheEntry *tcache) bms_free(this_bitmap); /* - * Done if it's not possible to find a longer sequence in the rest - * of the list. In typical cases this will happen on the first - * iteration, which is why we create the bitmaps on the fly instead - * of doing a second pass over the list. + * Done if it's not possible to find a longer sequence in the rest of + * the list. In typical cases this will happen on the first + * iteration, which is why we create the bitmaps on the fly instead of + * doing a second pass over the list. */ if (bm_size >= (numitems - start_pos - 1)) break; diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 9e58735aeec..337b875fe20 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -5,7 +5,7 @@ * * Because of the extremely high rate at which log messages can be generated, * we need to be mindful of the performance cost of obtaining any information - * that may be logged. Also, it's important to keep in mind that this code may + * that may be logged. Also, it's important to keep in mind that this code may * get called from within an aborted transaction, in which case operations * such as syscache lookups are unsafe. * @@ -1175,7 +1175,7 @@ elog_finish(int elevel, const char *fmt,...) * The result of format_elog_string() is stored in ErrorContext, and will * therefore survive until FlushErrorState() is called. */ -static int save_format_errnumber; +static int save_format_errnumber; static const char *save_format_domain; void @@ -1188,7 +1188,7 @@ pre_format_elog_string(int errnumber, const char *domain) } char * -format_elog_string(const char *fmt, ...) +format_elog_string(const char *fmt,...) { ErrorData errdata; ErrorData *edata; @@ -1725,8 +1725,9 @@ write_console(const char *line, int len) * WriteConsoleW() will fail of stdout is redirected, so just fall through * to writing unconverted to the logfile in this case. * - * Since we palloc the structure required for conversion, also fall through - * to writing unconverted if we have not yet set up CurrentMemoryContext. + * Since we palloc the structure required for conversion, also fall + * through to writing unconverted if we have not yet set up + * CurrentMemoryContext. */ if (GetDatabaseEncoding() != GetPlatformEncoding() && !in_error_recursion_trouble() && diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index e193e560eab..0288fbab4bc 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -34,7 +34,7 @@ * Hooks for function calls */ PGDLLIMPORT needs_fmgr_hook_type needs_fmgr_hook = NULL; -PGDLLIMPORT fmgr_hook_type fmgr_hook = NULL; +PGDLLIMPORT fmgr_hook_type fmgr_hook = NULL; /* * Declaration for old-style function pointer type. This is now used only @@ -192,7 +192,7 @@ fmgr_info_cxt_security(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt, * elogs. */ finfo->fn_oid = InvalidOid; - finfo->fn_collation = InvalidOid; /* caller may set this later */ + finfo->fn_collation = InvalidOid; /* caller may set this later */ finfo->fn_extra = NULL; finfo->fn_mcxt = mcxt; finfo->fn_expr = NULL; /* caller may set this later */ @@ -951,7 +951,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) /* function manager hook */ if (fmgr_hook) - (*fmgr_hook)(FHET_START, &fcache->flinfo, &fcache->arg); + (*fmgr_hook) (FHET_START, &fcache->flinfo, &fcache->arg); /* * We don't need to restore GUC or userid settings on error, because the @@ -982,7 +982,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) { fcinfo->flinfo = save_flinfo; if (fmgr_hook) - (*fmgr_hook)(FHET_ABORT, &fcache->flinfo, &fcache->arg); + (*fmgr_hook) (FHET_ABORT, &fcache->flinfo, &fcache->arg); PG_RE_THROW(); } PG_END_TRY(); @@ -994,7 +994,7 @@ fmgr_security_definer(PG_FUNCTION_ARGS) if (OidIsValid(fcache->userid)) SetUserIdAndSecContext(save_userid, save_sec_context); if (fmgr_hook) - (*fmgr_hook)(FHET_END, &fcache->flinfo, &fcache->arg); + (*fmgr_hook) (FHET_END, &fcache->flinfo, &fcache->arg); return result; } @@ -1278,7 +1278,7 @@ DirectFunctionCall9(PGFunction func, Datum arg1, Datum arg2, /* * These are the same as DirectFunctionCallN except that a nonzero - * collation can be specified. No other fields of FmgrInfo are made valid. + * collation can be specified. No other fields of FmgrInfo are made valid. */ Datum DirectFunctionCall1WithCollation(PGFunction func, Oid collation, Datum arg1) diff --git a/src/backend/utils/fmgr/funcapi.c b/src/backend/utils/fmgr/funcapi.c index cad4a371b7d..aa249fabfe8 100644 --- a/src/backend/utils/fmgr/funcapi.c +++ b/src/backend/utils/fmgr/funcapi.c @@ -489,8 +489,8 @@ resolve_polymorphic_tupdesc(TupleDesc tupdesc, oidvector *declared_args, return false; /* - * Identify the collation to use for polymorphic OUT parameters. - * (It'll necessarily be the same for both anyelement and anyarray.) + * Identify the collation to use for polymorphic OUT parameters. (It'll + * necessarily be the same for both anyelement and anyarray.) */ anycollation = get_typcollation(OidIsValid(anyelement_type) ? anyelement_type : anyarray_type); if (OidIsValid(anycollation)) @@ -500,7 +500,7 @@ resolve_polymorphic_tupdesc(TupleDesc tupdesc, oidvector *declared_args, * collation. We do so if we can identify the input collation used * for the function. */ - Oid inputcollation = exprInputCollation(call_expr); + Oid inputcollation = exprInputCollation(call_expr); if (OidIsValid(inputcollation)) anycollation = inputcollation; diff --git a/src/backend/utils/init/miscinit.c b/src/backend/utils/init/miscinit.c index ef6422e75c3..347a777da99 100644 --- a/src/backend/utils/init/miscinit.c +++ b/src/backend/utils/init/miscinit.c @@ -394,8 +394,8 @@ SetUserIdAndContext(Oid userid, bool sec_def_context) bool is_authenticated_user_replication_role(void) { - bool result = false; - HeapTuple utup; + bool result = false; + HeapTuple utup; utup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(AuthenticatedUserId)); if (HeapTupleIsValid(utup)) @@ -866,7 +866,7 @@ CreateLockFile(const char *filename, bool amPostmaster, "(key %lu, ID %lu) is still in use", id1, id2), errhint("If you're sure there are no old " - "server processes still running, remove " + "server processes still running, remove " "the shared memory block " "or just delete the file \"%s\".", filename))); @@ -889,8 +889,8 @@ CreateLockFile(const char *filename, bool amPostmaster, } /* - * Successfully created the file, now fill it. See comment in miscadmin.h - * about the contents. Note that we write the same info into both datadir + * Successfully created the file, now fill it. See comment in miscadmin.h + * about the contents. Note that we write the same info into both datadir * and socket lockfiles; although more stuff may get added to the datadir * lockfile later. */ @@ -904,7 +904,7 @@ CreateLockFile(const char *filename, bool amPostmaster, #else "" #endif - ); + ); errno = 0; if (write(fd, buffer, strlen(buffer)) != strlen(buffer)) diff --git a/src/backend/utils/init/postinit.c b/src/backend/utils/init/postinit.c index f3ca5a5cd6a..a4c5d4c69ab 100644 --- a/src/backend/utils/init/postinit.c +++ b/src/backend/utils/init/postinit.c @@ -222,8 +222,8 @@ PerformAuthentication(Port *port) { if (am_walsender) ereport(LOG, - (errmsg("replication connection authorized: user=%s", - port->user_name))); + (errmsg("replication connection authorized: user=%s", + port->user_name))); else ereport(LOG, (errmsg("connection authorized: user=%s database=%s", @@ -639,9 +639,9 @@ InitPostgres(const char *in_dbname, Oid dboid, const char *username, errmsg("remaining connection slots are reserved for non-replication superuser connections"))); /* - * If walsender, we don't want to connect to any particular database. - * Just finish the backend startup by processing any options from the - * startup packet, and we're done. + * If walsender, we don't want to connect to any particular database. Just + * finish the backend startup by processing any options from the startup + * packet, and we're done. */ if (am_walsender) { diff --git a/src/backend/utils/mb/mbutils.c b/src/backend/utils/mb/mbutils.c index b1281778036..234bb0cf6e8 100644 --- a/src/backend/utils/mb/mbutils.c +++ b/src/backend/utils/mb/mbutils.c @@ -77,7 +77,7 @@ static int cliplen(const char *str, int len, int limit); /* - * Prepare for a future call to SetClientEncoding. Success should mean + * Prepare for a future call to SetClientEncoding. Success should mean * that SetClientEncoding is guaranteed to succeed for this encoding request. * * (But note that success before backend_startup_complete does not guarantee @@ -149,7 +149,7 @@ PrepareClientEncoding(int encoding) /* * We cannot yet remove any older entry for the same encoding pair, - * since it could still be in use. SetClientEncoding will clean up. + * since it could still be in use. SetClientEncoding will clean up. */ return 0; /* success */ @@ -218,8 +218,8 @@ SetClientEncoding(int encoding) /* * Search the cache for the entry previously prepared by * PrepareClientEncoding; if there isn't one, we lose. While at it, - * release any duplicate entries so that repeated Prepare/Set cycles - * don't leak memory. + * release any duplicate entries so that repeated Prepare/Set cycles don't + * leak memory. */ found = false; foreach(lc, ConvProcList) @@ -591,7 +591,7 @@ pg_any_to_server(const char *s, int len, int encoding) return perform_default_encoding_conversion(s, len, true); else return (char *) pg_do_encoding_conversion( - (unsigned char *) s, len, encoding, DatabaseEncoding->encoding); + (unsigned char *) s, len, encoding, DatabaseEncoding->encoding); } /* @@ -626,7 +626,7 @@ pg_server_to_any(const char *s, int len, int encoding) return perform_default_encoding_conversion(s, len, false); else return (char *) pg_do_encoding_conversion( - (unsigned char *) s, len, DatabaseEncoding->encoding, encoding); + (unsigned char *) s, len, DatabaseEncoding->encoding, encoding); } /* diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 5e4904aeb7f..738e2152ba8 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -146,23 +146,23 @@ extern bool optimize_bounded_sort; static int GUC_check_errcode_value; /* global variables for check hook support */ -char *GUC_check_errmsg_string; -char *GUC_check_errdetail_string; -char *GUC_check_errhint_string; +char *GUC_check_errmsg_string; +char *GUC_check_errdetail_string; +char *GUC_check_errhint_string; static void set_config_sourcefile(const char *name, char *sourcefile, int sourceline); -static bool call_bool_check_hook(struct config_bool *conf, bool *newval, - void **extra, GucSource source, int elevel); -static bool call_int_check_hook(struct config_int *conf, int *newval, - void **extra, GucSource source, int elevel); -static bool call_real_check_hook(struct config_real *conf, double *newval, - void **extra, GucSource source, int elevel); -static bool call_string_check_hook(struct config_string *conf, char **newval, - void **extra, GucSource source, int elevel); -static bool call_enum_check_hook(struct config_enum *conf, int *newval, - void **extra, GucSource source, int elevel); +static bool call_bool_check_hook(struct config_bool * conf, bool *newval, + void **extra, GucSource source, int elevel); +static bool call_int_check_hook(struct config_int * conf, int *newval, + void **extra, GucSource source, int elevel); +static bool call_real_check_hook(struct config_real * conf, double *newval, + void **extra, GucSource source, int elevel); +static bool call_string_check_hook(struct config_string * conf, char **newval, + void **extra, GucSource source, int elevel); +static bool call_enum_check_hook(struct config_enum * conf, int *newval, + void **extra, GucSource source, int elevel); static bool check_log_destination(char **newval, void **extra, GucSource source); static void assign_log_destination(const char *newval, void *extra); @@ -1571,7 +1571,7 @@ static struct config_int ConfigureNamesInt[] = GUC_UNIT_S }, &wal_receiver_status_interval, - 10, 0, INT_MAX/1000, + 10, 0, INT_MAX / 1000, NULL, NULL, NULL }, @@ -1878,7 +1878,7 @@ static struct config_int ConfigureNamesInt[] = {"max_pred_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT, gettext_noop("Sets the maximum number of predicate locks per transaction."), gettext_noop("The shared predicate lock table is sized on the assumption that " - "at most max_pred_locks_per_transaction * max_connections distinct " + "at most max_pred_locks_per_transaction * max_connections distinct " "objects will need to be locked at any one time.") }, &max_predicate_locks_per_xact, @@ -3165,9 +3165,10 @@ static struct config_enum ConfigureNamesEnum[] = " the level, the fewer messages are sent.") }, &trace_recovery_messages, + /* - * client_message_level_options allows too many values, really, - * but it's not worth having a separate options array for this. + * client_message_level_options allows too many values, really, but + * it's not worth having a separate options array for this. */ LOG, client_message_level_options, NULL, NULL, NULL @@ -5100,8 +5101,8 @@ set_config_option(const char *name, const char *value, { /* * Historically we've just silently ignored attempts to set - * PGC_INTERNAL variables from the config file. Maybe it'd - * be better to use the prohibitValueChange logic for this? + * PGC_INTERNAL variables from the config file. Maybe it'd be + * better to use the prohibitValueChange logic for this? */ return true; } @@ -5559,8 +5560,8 @@ set_config_option(const char *name, const char *value, if (value) { /* - * The value passed by the caller could be transient, - * so we always strdup it. + * The value passed by the caller could be transient, so + * we always strdup it. */ newval = guc_strdup(elevel, value); if (newval == NULL) @@ -7922,7 +7923,7 @@ validate_option_array_item(const char *name, const char *value, * ERRCODE_INVALID_PARAMETER_VALUE SQLSTATE for check hook failures. * * Note that GUC_check_errmsg() etc are just macros that result in a direct - * assignment to the associated variables. That is ugly, but forced by the + * assignment to the associated variables. That is ugly, but forced by the * limitations of C's macro mechanisms. */ void @@ -7939,7 +7940,7 @@ GUC_check_errcode(int sqlerrcode) */ static bool -call_bool_check_hook(struct config_bool *conf, bool *newval, void **extra, +call_bool_check_hook(struct config_bool * conf, bool *newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -7973,7 +7974,7 @@ call_bool_check_hook(struct config_bool *conf, bool *newval, void **extra, } static bool -call_int_check_hook(struct config_int *conf, int *newval, void **extra, +call_int_check_hook(struct config_int * conf, int *newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -8007,7 +8008,7 @@ call_int_check_hook(struct config_int *conf, int *newval, void **extra, } static bool -call_real_check_hook(struct config_real *conf, double *newval, void **extra, +call_real_check_hook(struct config_real * conf, double *newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -8041,7 +8042,7 @@ call_real_check_hook(struct config_real *conf, double *newval, void **extra, } static bool -call_string_check_hook(struct config_string *conf, char **newval, void **extra, +call_string_check_hook(struct config_string * conf, char **newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -8075,7 +8076,7 @@ call_string_check_hook(struct config_string *conf, char **newval, void **extra, } static bool -call_enum_check_hook(struct config_enum *conf, int *newval, void **extra, +call_enum_check_hook(struct config_enum * conf, int *newval, void **extra, GucSource source, int elevel) { /* Quick success if no hook */ @@ -8365,9 +8366,9 @@ static bool check_canonical_path(char **newval, void **extra, GucSource source) { /* - * Since canonicalize_path never enlarges the string, we can just - * modify newval in-place. But watch out for NULL, which is the - * default value for external_pid_file. + * Since canonicalize_path never enlarges the string, we can just modify + * newval in-place. But watch out for NULL, which is the default value + * for external_pid_file. */ if (*newval) canonicalize_path(*newval); @@ -8378,12 +8379,12 @@ static bool check_timezone_abbreviations(char **newval, void **extra, GucSource source) { /* - * The boot_val given above for timezone_abbreviations is NULL. - * When we see this we just do nothing. If this value isn't overridden - * from the config file then pg_timezone_abbrev_initialize() will - * eventually replace it with "Default". This hack has two purposes: to - * avoid wasting cycles loading values that might soon be overridden from - * the config file, and to avoid trying to read the timezone abbrev files + * The boot_val given above for timezone_abbreviations is NULL. When we + * see this we just do nothing. If this value isn't overridden from the + * config file then pg_timezone_abbrev_initialize() will eventually + * replace it with "Default". This hack has two purposes: to avoid + * wasting cycles loading values that might soon be overridden from the + * config file, and to avoid trying to read the timezone abbrev files * during InitializeGUCOptions(). The latter doesn't work in an * EXEC_BACKEND subprocess because my_exec_path hasn't been set yet and so * we can't locate PGSHAREDIR. @@ -8443,15 +8444,15 @@ static void assign_tcp_keepalives_idle(int newval, void *extra) { /* - * The kernel API provides no way to test a value without setting it; - * and once we set it we might fail to unset it. So there seems little - * point in fully implementing the check-then-assign GUC API for these + * The kernel API provides no way to test a value without setting it; and + * once we set it we might fail to unset it. So there seems little point + * in fully implementing the check-then-assign GUC API for these * variables. Instead we just do the assignment on demand. pqcomm.c * reports any problems via elog(LOG). * - * This approach means that the GUC value might have little to do with - * the actual kernel value, so we use a show_hook that retrieves the - * kernel value rather than trusting GUC's copy. + * This approach means that the GUC value might have little to do with the + * actual kernel value, so we use a show_hook that retrieves the kernel + * value rather than trusting GUC's copy. */ (void) pq_setkeepalivesidle(newval, MyProcPort); } @@ -8574,7 +8575,7 @@ check_effective_io_concurrency(int *newval, void **extra, GucSource source) /* This range check shouldn't fail, but let's be paranoid */ if (new_prefetch_pages >= 0.0 && new_prefetch_pages < (double) INT_MAX) { - int *myextra = (int *) guc_malloc(ERROR, sizeof(int)); + int *myextra = (int *) guc_malloc(ERROR, sizeof(int)); *myextra = (int) rint(new_prefetch_pages); *extra = (void *) myextra; diff --git a/src/backend/utils/misc/rbtree.c b/src/backend/utils/misc/rbtree.c index 7a8ddf0a17e..f8143724d0a 100644 --- a/src/backend/utils/misc/rbtree.c +++ b/src/backend/utils/misc/rbtree.c @@ -75,7 +75,7 @@ struct RBTree */ #define RBNIL (&sentinel) -static RBNode sentinel = {InitialState, RBBLACK, RBNIL, RBNIL, NULL}; +static RBNode sentinel = {InitialState, RBBLACK, RBNIL, RBNIL, NULL}; /* @@ -99,10 +99,10 @@ static RBNode sentinel = {InitialState, RBBLACK, RBNIL, RBNIL, NULL}; * * The freefunc should just be pfree or equivalent; it should NOT attempt * to free any subsidiary data, because the node passed to it may not contain - * valid data! freefunc can be NULL if caller doesn't require retail + * valid data! freefunc can be NULL if caller doesn't require retail * space reclamation. * - * The RBTree node is palloc'd in the caller's memory context. Note that + * The RBTree node is palloc'd in the caller's memory context. Note that * all contents of the tree are actually allocated by the caller, not here. * * Since tree contents are managed by the caller, there is currently not @@ -130,6 +130,7 @@ rb_create(Size node_size, tree->combiner = combiner; tree->allocfunc = allocfunc; tree->freefunc = freefunc; + tree->arg = arg; return tree; @@ -161,7 +162,7 @@ rb_find(RBTree *rb, const RBNode *data) while (node != RBNIL) { - int cmp = rb->comparator(data, node, rb->arg); + int cmp = rb->comparator(data, node, rb->arg); if (cmp == 0) return node; @@ -434,10 +435,11 @@ rb_insert(RBTree *rb, const RBNode *data, bool *isNew) */ *isNew = true; - x = rb->allocfunc(rb->arg); + x = rb->allocfunc (rb->arg); x->iteratorState = InitialState; x->color = RBRED; + x->left = RBNIL; x->right = RBNIL; x->parent = parent; @@ -629,7 +631,7 @@ rb_delete_node(RBTree *rb, RBNode *z) /* Now we can recycle the y node */ if (rb->freefunc) - rb->freefunc(y, rb->arg); + rb->freefunc (y, rb->arg); } /* diff --git a/src/backend/utils/misc/tzparser.c b/src/backend/utils/misc/tzparser.c index b2f6dd3a2bb..b52942db721 100644 --- a/src/backend/utils/misc/tzparser.c +++ b/src/backend/utils/misc/tzparser.c @@ -4,7 +4,7 @@ * Functions for parsing timezone offset files * * Note: this code is invoked from the check_hook for the GUC variable - * timezone_abbreviations. Therefore, it should report problems using + * timezone_abbreviations. Therefore, it should report problems using * GUC_check_errmsg() and related functions, and try to avoid throwing * elog(ERROR). This is not completely bulletproof at present --- in * particular out-of-memory will throw an error. Could probably fix with diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index b28dc474203..e95dcb6b7cf 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -165,7 +165,7 @@ typedef struct AllocBlockData AllocBlock next; /* next block in aset's blocks list */ char *freeptr; /* start of free space in this block */ char *endptr; /* end of space in this block */ -} AllocBlockData; +} AllocBlockData; /* * AllocChunk @@ -184,7 +184,7 @@ typedef struct AllocChunkData /* this is zero in a free chunk */ Size requested_size; #endif -} AllocChunkData; +} AllocChunkData; /* * AllocPointerIsValid diff --git a/src/backend/utils/mmgr/portalmem.c b/src/backend/utils/mmgr/portalmem.c index 7fa66b42212..186548dcba5 100644 --- a/src/backend/utils/mmgr/portalmem.c +++ b/src/backend/utils/mmgr/portalmem.c @@ -413,8 +413,8 @@ MarkPortalDone(Portal portal) portal->status = PORTAL_DONE; /* - * Allow portalcmds.c to clean up the state it knows about. We might - * as well do that now, since the portal can't be executed any more. + * Allow portalcmds.c to clean up the state it knows about. We might as + * well do that now, since the portal can't be executed any more. * * In some cases involving execution of a ROLLBACK command in an already * aborted transaction, this prevents an assertion failure from reaching @@ -449,7 +449,7 @@ PortalDrop(Portal portal, bool isTopCommit) /* * Allow portalcmds.c to clean up the state it knows about, in particular - * shutting down the executor if still active. This step potentially runs + * shutting down the executor if still active. This step potentially runs * user-defined code so failure has to be expected. It's the cleanup * hook's responsibility to not try to do that more than once, in the case * that failure occurs and then we come back to drop the portal again @@ -577,7 +577,7 @@ PortalHashTableDeleteAll(void) * Holdable cursors created in this transaction need to be converted to * materialized form, since we are going to close down the executor and * release locks. Non-holdable portals created in this transaction are - * simply removed. Portals remaining from prior transactions should be + * simply removed. Portals remaining from prior transactions should be * left untouched. * * Returns TRUE if any portals changed state (possibly causing user-defined @@ -678,9 +678,9 @@ PreCommit_Portals(bool isPrepare) } /* - * After either freezing or dropping a portal, we have to restart - * the iteration, because we could have invoked user-defined code - * that caused a drop of the next portal in the hash chain. + * After either freezing or dropping a portal, we have to restart the + * iteration, because we could have invoked user-defined code that + * caused a drop of the next portal in the hash chain. */ hash_seq_term(&status); hash_seq_init(&status, PortalHashTable); diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c index c1ba5ad8e64..e5461e660ef 100644 --- a/src/backend/utils/resowner/resowner.c +++ b/src/backend/utils/resowner/resowner.c @@ -78,7 +78,7 @@ typedef struct ResourceOwnerData int nfiles; /* number of owned temporary files */ File *files; /* dynamically allocated array */ int maxfiles; /* currently allocated array size */ -} ResourceOwnerData; +} ResourceOwnerData; /***************************************************************************** diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index a1850b83c5e..bd5b4b0a7d7 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -351,7 +351,7 @@ struct Tuplesortstate * indexScanKey. */ IndexInfo *indexInfo; /* info about index being used for reference */ - EState *estate; /* for evaluating index expressions */ + EState *estate; /* for evaluating index expressions */ /* * These variables are specific to the IndexTuple case; they are set by @@ -469,12 +469,12 @@ static void readtup_heap(Tuplesortstate *state, SortTuple *stup, int tapenum, unsigned int len); static void reversedirection_heap(Tuplesortstate *state); static int comparetup_cluster(const SortTuple *a, const SortTuple *b, - Tuplesortstate *state); + Tuplesortstate *state); static void copytup_cluster(Tuplesortstate *state, SortTuple *stup, void *tup); static void writetup_cluster(Tuplesortstate *state, int tapenum, - SortTuple *stup); + SortTuple *stup); static void readtup_cluster(Tuplesortstate *state, SortTuple *stup, - int tapenum, unsigned int len); + int tapenum, unsigned int len); static int comparetup_index_btree(const SortTuple *a, const SortTuple *b, Tuplesortstate *state); static int comparetup_index_hash(const SortTuple *a, const SortTuple *b, @@ -582,7 +582,7 @@ tuplesort_begin_common(int workMem, bool randomAccess) Tuplesortstate * tuplesort_begin_heap(TupleDesc tupDesc, int nkeys, AttrNumber *attNums, - Oid *sortOperators, Oid *collations, bool *nullsFirstFlags, + Oid *sortOperators, Oid *collations, bool *nullsFirstFlags, int workMem, bool randomAccess) { Tuplesortstate *state = tuplesort_begin_common(workMem, randomAccess); @@ -699,7 +699,7 @@ tuplesort_begin_cluster(TupleDesc tupDesc, if (state->indexInfo->ii_Expressions != NULL) { TupleTableSlot *slot; - ExprContext *econtext; + ExprContext *econtext; /* * We will need to use FormIndexDatum to evaluate the index @@ -796,7 +796,7 @@ tuplesort_begin_index_hash(Relation indexRel, Tuplesortstate * tuplesort_begin_datum(Oid datumType, - Oid sortOperator, Oid sortCollation, bool nullsFirstFlag, + Oid sortOperator, Oid sortCollation, bool nullsFirstFlag, int workMem, bool randomAccess) { Tuplesortstate *state = tuplesort_begin_common(workMem, randomAccess); @@ -945,7 +945,7 @@ tuplesort_end(Tuplesortstate *state) /* Free any execution state created for CLUSTER case */ if (state->estate != NULL) { - ExprContext *econtext = GetPerTupleExprContext(state->estate); + ExprContext *econtext = GetPerTupleExprContext(state->estate); ExecDropSingleTupleTableSlot(econtext->ecxt_scantuple); FreeExecutorState(state->estate); @@ -1546,7 +1546,7 @@ tuplesort_gettupleslot(Tuplesortstate *state, bool forward, /* * Fetch the next tuple in either forward or back direction. - * Returns NULL if no more tuples. If *should_free is set, the + * Returns NULL if no more tuples. If *should_free is set, the * caller must pfree the returned tuple when done with it. */ HeapTuple diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c index 9100c818f89..ef66466baf1 100644 --- a/src/backend/utils/time/snapmgr.c +++ b/src/backend/utils/time/snapmgr.c @@ -41,7 +41,7 @@ * CurrentSnapshot points to the only snapshot taken in transaction-snapshot * mode, and to the latest one taken in a read-committed transaction. * SecondarySnapshot is a snapshot that's always up-to-date as of the current - * instant, even in transaction-snapshot mode. It should only be used for + * instant, even in transaction-snapshot mode. It should only be used for * special-purpose code (say, RI checking.) * * These SnapshotData structs are static to simplify memory allocation @@ -533,8 +533,8 @@ void AtEarlyCommit_Snapshot(void) { /* - * In transaction-snapshot mode we must unregister our private refcount - * to the transaction-snapshot. + * In transaction-snapshot mode we must unregister our private refcount to + * the transaction-snapshot. */ if (registered_xact_snapshot) UnregisterSnapshotFromOwner(CurrentSnapshot, |