diff options
Diffstat (limited to 'src/backend/utils')
39 files changed, 197 insertions, 194 deletions
diff --git a/src/backend/utils/adt/array_typanalyze.c b/src/backend/utils/adt/array_typanalyze.c index 85b7a432920..e3ef18cace9 100644 --- a/src/backend/utils/adt/array_typanalyze.c +++ b/src/backend/utils/adt/array_typanalyze.c @@ -751,8 +751,8 @@ element_compare(const void *key1, const void *key2) static int trackitem_compare_frequencies_desc(const void *e1, const void *e2) { - const TrackItem *const * t1 = (const TrackItem *const *) e1; - const TrackItem *const * t2 = (const TrackItem *const *) e2; + const TrackItem *const *t1 = (const TrackItem *const *) e1; + const TrackItem *const *t2 = (const TrackItem *const *) e2; return (*t2)->frequency - (*t1)->frequency; } @@ -763,8 +763,8 @@ trackitem_compare_frequencies_desc(const void *e1, const void *e2) static int trackitem_compare_element(const void *e1, const void *e2) { - const TrackItem *const * t1 = (const TrackItem *const *) e1; - const TrackItem *const * t2 = (const TrackItem *const *) e2; + const TrackItem *const *t1 = (const TrackItem *const *) e1; + const TrackItem *const *t2 = (const TrackItem *const *) e2; return element_compare(&(*t1)->key, &(*t2)->key); } @@ -775,8 +775,8 @@ trackitem_compare_element(const void *e1, const void *e2) static int countitem_compare_count(const void *e1, const void *e2) { - const DECountItem *const * t1 = (const DECountItem *const *) e1; - const DECountItem *const * t2 = (const DECountItem *const *) e2; + const DECountItem *const *t1 = (const DECountItem *const *) e1; + const DECountItem *const *t2 = (const DECountItem *const *) e2; if ((*t1)->count < (*t2)->count) return -1; diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c index d9c8aa569c9..1d202dba120 100644 --- a/src/backend/utils/adt/arrayfuncs.c +++ b/src/backend/utils/adt/arrayfuncs.c @@ -84,7 +84,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); diff --git a/src/backend/utils/adt/arrayutils.c b/src/backend/utils/adt/arrayutils.c index a46d8629c30..27b24703b0b 100644 --- a/src/backend/utils/adt/arrayutils.c +++ b/src/backend/utils/adt/arrayutils.c @@ -93,7 +93,7 @@ ArrayGetNItems(int ndim, const int *dims) errmsg("array size exceeds the maximum allowed (%d)", (int) MaxArraySize))); - prod = (int64) ret *(int64) dims[i]; + prod = (int64) ret * (int64) dims[i]; ret = (int32) prod; if ((int64) ret != prod) diff --git a/src/backend/utils/adt/cash.c b/src/backend/utils/adt/cash.c index a170294b942..677037c246b 100644 --- a/src/backend/utils/adt/cash.c +++ b/src/backend/utils/adt/cash.c @@ -84,7 +84,7 @@ num_word(Cash value) } return buf; -} /* num_word() */ +} /* num_word() */ /* cash_in() * Convert a string to a cash data type. @@ -132,7 +132,7 @@ cash_in(PG_FUNCTION_ARGS) dsymbol = '.'; if (*lconvert->mon_thousands_sep != '\0') ssymbol = lconvert->mon_thousands_sep; - else /* ssymbol should not equal dsymbol */ + else /* ssymbol should not equal dsymbol */ ssymbol = (dsymbol != ',') ? "," : "."; csymbol = (*lconvert->currency_symbol != '\0') ? lconvert->currency_symbol : "$"; psymbol = (*lconvert->positive_sign != '\0') ? lconvert->positive_sign : "+"; @@ -347,7 +347,7 @@ cash_out(PG_FUNCTION_ARGS) dsymbol = '.'; if (*lconvert->mon_thousands_sep != '\0') ssymbol = lconvert->mon_thousands_sep; - else /* ssymbol should not equal dsymbol */ + else /* ssymbol should not equal dsymbol */ ssymbol = (dsymbol != ',') ? "," : "."; csymbol = (*lconvert->currency_symbol != '\0') ? lconvert->currency_symbol : "$"; diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c index 76ab9496e2e..3095047f0b4 100644 --- a/src/backend/utils/adt/date.c +++ b/src/backend/utils/adt/date.c @@ -41,10 +41,10 @@ #endif -static int time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec); -static int timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp); -static int tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result); -static int tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result); +static int time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec); +static int timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp); +static int tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result); +static int tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result); static void AdjustTimeForTypmod(TimeADT *time, int32 typmod); @@ -302,7 +302,7 @@ EncodeSpecialDate(DateADT dt, char *str) strcpy(str, EARLY); else if (DATE_IS_NOEND(dt)) strcpy(str, LATE); - else /* shouldn't happen */ + else /* shouldn't happen */ elog(ERROR, "invalid argument for EncodeSpecialDate"); } @@ -1235,7 +1235,7 @@ time_in(PG_FUNCTION_ARGS) * Convert a tm structure to a time data type. */ static int -tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result) +tm2time(struct pg_tm *tm, fsec_t fsec, TimeADT *result) { *result = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec) * USECS_PER_SEC) + fsec; @@ -1250,7 +1250,7 @@ tm2time(struct pg_tm * tm, fsec_t fsec, TimeADT *result) * if pg_time_t is just 32 bits) - thomas 97/05/27 */ static int -time2tm(TimeADT time, struct pg_tm * tm, fsec_t *fsec) +time2tm(TimeADT time, struct pg_tm *tm, fsec_t *fsec) { tm->tm_hour = time / USECS_PER_HOUR; time -= tm->tm_hour * USECS_PER_HOUR; @@ -1934,7 +1934,7 @@ time_part(PG_FUNCTION_ARGS) * Convert a tm structure to a time data type. */ static int -tm2timetz(struct pg_tm * tm, fsec_t fsec, int tz, TimeTzADT *result) +tm2timetz(struct pg_tm *tm, fsec_t fsec, int tz, TimeTzADT *result) { result->time = ((((tm->tm_hour * MINS_PER_HOUR + tm->tm_min) * SECS_PER_MINUTE) + tm->tm_sec) * USECS_PER_SEC) + fsec; @@ -2068,7 +2068,7 @@ timetztypmodout(PG_FUNCTION_ARGS) * Convert TIME WITH TIME ZONE data type to POSIX time structure. */ static int -timetz2tm(TimeTzADT *time, struct pg_tm * tm, fsec_t *fsec, int *tzp) +timetz2tm(TimeTzADT *time, struct pg_tm *tm, fsec_t *fsec, int *tzp) { TimeOffset trem = time->time; diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 30db3bf7e59..107b8fdad97 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -34,22 +34,22 @@ static int DecodeNumber(int flen, char *field, bool haveTextMonth, int fmask, int *tmask, - struct pg_tm * tm, fsec_t *fsec, bool *is2digits); + struct pg_tm *tm, fsec_t *fsec, bool *is2digits); static int DecodeNumberField(int len, char *str, int fmask, int *tmask, - struct pg_tm * tm, fsec_t *fsec, bool *is2digits); + struct pg_tm *tm, fsec_t *fsec, bool *is2digits); static int DecodeTime(char *str, int fmask, int range, - int *tmask, struct pg_tm * tm, fsec_t *fsec); + int *tmask, struct pg_tm *tm, fsec_t *fsec); static const datetkn *datebsearch(const char *key, const datetkn *base, int nel); static int DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, - struct pg_tm * tm); + struct pg_tm *tm); static char *AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros); -static void AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, +static void AdjustFractSeconds(double frac, struct pg_tm *tm, fsec_t *fsec, int scale); -static void AdjustFractDays(double frac, struct pg_tm * tm, fsec_t *fsec, +static void AdjustFractDays(double frac, struct pg_tm *tm, fsec_t *fsec, int scale); -static int DetermineTimeZoneOffsetInternal(struct pg_tm * tm, pg_tz *tzp, +static int DetermineTimeZoneOffsetInternal(struct pg_tm *tm, pg_tz *tzp, pg_time_t *tp); static bool DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t, const char *abbr, pg_tz *tzp, @@ -311,7 +311,7 @@ date2j(int y, int m, int d) julian += 7834 * m / 256 + d; return julian; -} /* date2j() */ +} /* date2j() */ void j2date(int jd, int *year, int *month, int *day) @@ -338,7 +338,7 @@ j2date(int jd, int *year, int *month, int *day) *month = (quad + 10) % MONTHS_PER_YEAR + 1; return; -} /* j2date() */ +} /* j2date() */ /* @@ -358,7 +358,7 @@ j2day(int date) date += 7; return date; -} /* j2day() */ +} /* j2day() */ /* @@ -367,7 +367,7 @@ j2day(int date) * Get the transaction start time ("now()") broken down as a struct pg_tm. */ void -GetCurrentDateTime(struct pg_tm * tm) +GetCurrentDateTime(struct pg_tm *tm) { int tz; fsec_t fsec; @@ -384,7 +384,7 @@ GetCurrentDateTime(struct pg_tm * tm) * including fractional seconds and timezone offset. */ void -GetCurrentTimeUsec(struct pg_tm * tm, fsec_t *fsec, int *tzp) +GetCurrentTimeUsec(struct pg_tm *tm, fsec_t *fsec, int *tzp) { int tz; @@ -471,7 +471,7 @@ AppendSeconds(char *cp, int sec, fsec_t fsec, int precision, bool fillzeros) * there; callers are responsible for NUL terminating str themselves. */ static char * -AppendTimestampSeconds(char *cp, struct pg_tm * tm, fsec_t fsec) +AppendTimestampSeconds(char *cp, struct pg_tm *tm, fsec_t fsec) { return AppendSeconds(cp, tm->tm_sec, fsec, MAX_TIMESTAMP_PRECISION, true); } @@ -481,7 +481,7 @@ AppendTimestampSeconds(char *cp, struct pg_tm * tm, fsec_t fsec) * We assume the input frac is less than 1 so overflow is not an issue. */ static void -AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, int scale) +AdjustFractSeconds(double frac, struct pg_tm *tm, fsec_t *fsec, int scale) { int sec; @@ -496,7 +496,7 @@ AdjustFractSeconds(double frac, struct pg_tm * tm, fsec_t *fsec, int scale) /* As above, but initial scale produces days */ static void -AdjustFractDays(double frac, struct pg_tm * tm, fsec_t *fsec, int scale) +AdjustFractDays(double frac, struct pg_tm *tm, fsec_t *fsec, int scale) { int extra_days; @@ -781,7 +781,7 @@ ParseDateTime(const char *timestr, char *workbuf, size_t buflen, */ int DecodeDateTime(char **field, int *ftype, int nf, - int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp) + int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp) { int fmask = 0, tmask, @@ -1468,7 +1468,7 @@ DecodeDateTime(char **field, int *ftype, int nf, * though probably some higher-level code will. */ int -DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp) +DetermineTimeZoneOffset(struct pg_tm *tm, pg_tz *tzp) { pg_time_t t; @@ -1490,7 +1490,7 @@ DetermineTimeZoneOffset(struct pg_tm * tm, pg_tz *tzp) * of mktime(), anyway. */ static int -DetermineTimeZoneOffsetInternal(struct pg_tm * tm, pg_tz *tzp, pg_time_t *tp) +DetermineTimeZoneOffsetInternal(struct pg_tm *tm, pg_tz *tzp, pg_time_t *tp) { int date, sec; @@ -1626,7 +1626,7 @@ overflow: * back to doing DetermineTimeZoneOffset().) */ int -DetermineTimeZoneAbbrevOffset(struct pg_tm * tm, const char *abbr, pg_tz *tzp) +DetermineTimeZoneAbbrevOffset(struct pg_tm *tm, const char *abbr, pg_tz *tzp) { pg_time_t t; int zone_offset; @@ -1742,7 +1742,7 @@ DetermineTimeZoneAbbrevOffsetInternal(pg_time_t t, const char *abbr, pg_tz *tzp, */ int DecodeTimeOnly(char **field, int *ftype, int nf, - int *dtype, struct pg_tm * tm, fsec_t *fsec, int *tzp) + int *dtype, struct pg_tm *tm, fsec_t *fsec, int *tzp) { int fmask = 0, tmask, @@ -2367,7 +2367,7 @@ DecodeTimeOnly(char **field, int *ftype, int nf, */ static int DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, - struct pg_tm * tm) + struct pg_tm *tm) { fsec_t fsec; int nf = 0; @@ -2477,7 +2477,7 @@ DecodeDate(char *str, int fmask, int *tmask, bool *is2digits, */ int ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, - struct pg_tm * tm) + struct pg_tm *tm) { if (fmask & DTK_M(YEAR)) { @@ -2556,7 +2556,7 @@ ValidateDate(int fmask, bool isjulian, bool is2digits, bool bc, */ static int DecodeTime(char *str, int fmask, int range, - int *tmask, struct pg_tm * tm, fsec_t *fsec) + int *tmask, struct pg_tm *tm, fsec_t *fsec) { char *cp; int dterr; @@ -2632,7 +2632,7 @@ DecodeTime(char *str, int fmask, int range, */ static int DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask, - int *tmask, struct pg_tm * tm, fsec_t *fsec, bool *is2digits) + int *tmask, struct pg_tm *tm, fsec_t *fsec, bool *is2digits) { int val; char *cp; @@ -2817,7 +2817,7 @@ DecodeNumber(int flen, char *str, bool haveTextMonth, int fmask, */ static int DecodeNumberField(int len, char *str, int fmask, - int *tmask, struct pg_tm * tm, fsec_t *fsec, bool *is2digits) + int *tmask, struct pg_tm *tm, fsec_t *fsec, bool *is2digits) { char *cp; @@ -3068,7 +3068,7 @@ DecodeSpecial(int field, char *lowtoken, int *val) * Zero out a pg_tm and associated fsec_t */ static inline void -ClearPgTm(struct pg_tm * tm, fsec_t *fsec) +ClearPgTm(struct pg_tm *tm, fsec_t *fsec) { tm->tm_year = 0; tm->tm_mon = 0; @@ -3093,7 +3093,7 @@ ClearPgTm(struct pg_tm * tm, fsec_t *fsec) */ int DecodeInterval(char **field, int *ftype, int nf, int range, - int *dtype, struct pg_tm * tm, fsec_t *fsec) + int *dtype, struct pg_tm *tm, fsec_t *fsec) { bool is_before = FALSE; char *cp; @@ -3519,7 +3519,7 @@ ISO8601IntegerWidth(char *fieldstart) */ int DecodeISO8601Interval(char *str, - int *dtype, struct pg_tm * tm, fsec_t *fsec) + int *dtype, struct pg_tm *tm, fsec_t *fsec) { bool datepart = true; bool havefield = false; @@ -3749,7 +3749,7 @@ DecodeUnits(int field, char *lowtoken, int *val) } return type; -} /* DecodeUnits() */ +} /* DecodeUnits() */ /* * Report an error detected by one of the datetime input processing routines. @@ -3881,7 +3881,7 @@ EncodeTimezone(char *str, int tz, int style) * Encode date as local time. */ void -EncodeDateOnly(struct pg_tm * tm, int style, char *str) +EncodeDateOnly(struct pg_tm *tm, int style, char *str) { Assert(tm->tm_mon >= 1 && tm->tm_mon <= MONTHS_PER_YEAR); @@ -3966,7 +3966,7 @@ EncodeDateOnly(struct pg_tm * tm, int style, char *str) * output. */ void -EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style, char *str) +EncodeTimeOnly(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, int style, char *str) { str = pg_ltostr_zeropad(str, tm->tm_hour, 2); *str++ = ':'; @@ -3996,7 +3996,7 @@ EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, int style, * XSD - yyyy-mm-ddThh:mm:ss.ss+/-tz */ void -EncodeDateTime(struct pg_tm * tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str) +EncodeDateTime(struct pg_tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str) { int day; @@ -4238,7 +4238,7 @@ AddVerboseIntPart(char *cp, int value, const char *units, * "day-time literal"s (that look like ('4 5:6:7') */ void -EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) +EncodeInterval(struct pg_tm *tm, fsec_t fsec, int style, char *str) { char *cp = str; int year = tm->tm_year; diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c index f0725860b4b..ac4feddbfd3 100644 --- a/src/backend/utils/adt/dbsize.c +++ b/src/backend/utils/adt/dbsize.c @@ -889,7 +889,7 @@ pg_relation_filenode(PG_FUNCTION_ARGS) /* okay, these have storage */ if (relform->relfilenode) result = relform->relfilenode; - else /* Consult the relation mapper */ + else /* Consult the relation mapper */ result = RelationMapOidToFilenode(relid, relform->relisshared); break; @@ -976,7 +976,7 @@ pg_relation_filepath(PG_FUNCTION_ARGS) rnode.dbNode = MyDatabaseId; if (relform->relfilenode) rnode.relNode = relform->relfilenode; - else /* Consult the relation mapper */ + else /* Consult the relation mapper */ rnode.relNode = RelationMapOidToFilenode(relid, relform->relisshared); break; diff --git a/src/backend/utils/adt/encode.c b/src/backend/utils/adt/encode.c index 8fd8ede39e5..8773538b8d5 100644 --- a/src/backend/utils/adt/encode.c +++ b/src/backend/utils/adt/encode.c @@ -520,7 +520,7 @@ static const struct { const char *name; struct pg_encoding enc; -} enclist[] = +} enclist[] = { { diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 4127bece12a..ba7e4fc934f 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -667,7 +667,7 @@ typedef enum /* last */ _DCH_last_ -} DCH_poz; +} DCH_poz; typedef enum { @@ -710,7 +710,7 @@ typedef enum /* last */ _NUM_last_ -} NUM_poz; +} NUM_poz; /* ---------- * KeyWords for DATE-TIME version @@ -976,10 +976,10 @@ static void from_char_set_mode(TmFromChar *tmfc, const FromCharDateMode mode); static void from_char_set_int(int *dest, const int value, const FormatNode *node); static int from_char_parse_int_len(int *dest, char **src, const int len, FormatNode *node); static int from_char_parse_int(int *dest, char **src, FormatNode *node); -static int seq_search(char *name, const char *const * array, int type, int max, int *len); -static int from_char_seq_search(int *dest, char **src, const char *const * array, int type, int max, FormatNode *node); +static int seq_search(char *name, const char *const *array, int type, int max, int *len); +static int from_char_seq_search(int *dest, char **src, const char *const *array, int type, int max, FormatNode *node); static void do_to_timestamp(text *date_txt, text *fmt, - struct pg_tm * tm, fsec_t *fsec); + struct pg_tm *tm, fsec_t *fsec); static char *fill_str(char *str, int c, int max); static FormatNode *NUM_cache(int len, NUMDesc *Num, text *pars_str, bool *shouldFree); static char *int_to_roman(int number); @@ -1450,9 +1450,9 @@ str_numth(char *dest, char *num, int type) #ifdef USE_ICU typedef int32_t (*ICU_Convert_Func) (UChar *dest, int32_t destCapacity, - const UChar *src, int32_t srcLength, - const char *locale, - UErrorCode *pErrorCode); + const UChar *src, int32_t srcLength, + const char *locale, + UErrorCode *pErrorCode); static int32_t icu_convert_case(ICU_Convert_Func func, pg_locale_t mylocale, @@ -2303,10 +2303,10 @@ from_char_parse_int(int *dest, char **src, FormatNode *node) * ---------- */ static int -seq_search(char *name, const char *const * array, int type, int max, int *len) +seq_search(char *name, const char *const *array, int type, int max, int *len) { const char *p; - const char *const * a; + const char *const *a; char *n; int last, i; @@ -2381,7 +2381,7 @@ seq_search(char *name, const char *const * array, int type, int max, int *len) * If the string doesn't match, throw an error. */ static int -from_char_seq_search(int *dest, char **src, const char *const * array, int type, int max, +from_char_seq_search(int *dest, char **src, const char *const *array, int type, int max, FormatNode *node) { int len; @@ -3609,7 +3609,7 @@ to_date(PG_FUNCTION_ARGS) */ static void do_to_timestamp(text *date_txt, text *fmt, - struct pg_tm * tm, fsec_t *fsec) + struct pg_tm *tm, fsec_t *fsec) { FormatNode *format; TmFromChar tmfc; diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c index 655b81cc468..40de01b7bc9 100644 --- a/src/backend/utils/adt/geo_ops.c +++ b/src/backend/utils/adt/geo_ops.c @@ -126,7 +126,7 @@ single_decode(char *num, char **endptr_p, const char *type_name, const char *orig_string) { return float8in_internal(num, endptr_p, type_name, orig_string); -} /* single_decode() */ +} /* single_decode() */ static void single_encode(float8 x, StringInfo str) @@ -135,7 +135,7 @@ single_encode(float8 x, StringInfo str) appendStringInfoString(str, xstr); pfree(xstr); -} /* single_encode() */ +} /* single_encode() */ static void pair_decode(char *str, double *x, double *y, char **endptr_p, @@ -264,7 +264,7 @@ path_decode(char *str, bool opentype, int npts, Point *p, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("invalid input syntax for type %s: \"%s\"", type_name, orig_string))); -} /* path_decode() */ +} /* path_decode() */ static char * path_encode(enum path_delim path_delim, int npts, Point *pt) @@ -309,7 +309,7 @@ path_encode(enum path_delim path_delim, int npts, Point *pt) } return str.data; -} /* path_encode() */ +} /* path_encode() */ /*------------------------------------------------------------- * pair_count - count the number of points @@ -1333,7 +1333,7 @@ path_in(PG_FUNCTION_ARGS) } base_size = sizeof(path->p[0]) * npts; - size = offsetof(PATH, p) +base_size; + size = offsetof(PATH, p) + base_size; /* Check for integer overflow */ if (base_size / npts != sizeof(path->p[0]) || size <= base_size) @@ -1403,7 +1403,7 @@ path_recv(PG_FUNCTION_ARGS) (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), errmsg("invalid number of points in external \"path\" value"))); - size = offsetof(PATH, p) +sizeof(path->p[0]) * npts; + size = offsetof(PATH, p) + sizeof(path->p[0]) * npts; path = (PATH *) palloc(size); SET_VARSIZE(path, size); @@ -3431,7 +3431,7 @@ poly_in(PG_FUNCTION_ARGS) "polygon", str))); base_size = sizeof(poly->p[0]) * npts; - size = offsetof(POLYGON, p) +base_size; + size = offsetof(POLYGON, p) + base_size; /* Check for integer overflow */ if (base_size / npts != sizeof(poly->p[0]) || size <= base_size) @@ -3486,7 +3486,7 @@ poly_recv(PG_FUNCTION_ARGS) (errcode(ERRCODE_INVALID_BINARY_REPRESENTATION), errmsg("invalid number of points in external \"polygon\" value"))); - size = offsetof(POLYGON, p) +sizeof(poly->p[0]) * npts; + size = offsetof(POLYGON, p) + sizeof(poly->p[0]) * npts; poly = (POLYGON *) palloc0(size); /* zero any holes */ SET_VARSIZE(poly, size); @@ -4243,7 +4243,7 @@ path_add(PG_FUNCTION_ARGS) PG_RETURN_NULL(); base_size = sizeof(p1->p[0]) * (p1->npts + p2->npts); - size = offsetof(PATH, p) +base_size; + size = offsetof(PATH, p) + base_size; /* Check for integer overflow */ if (base_size / sizeof(p1->p[0]) != (p1->npts + p2->npts) || @@ -4385,7 +4385,7 @@ path_poly(PG_FUNCTION_ARGS) * Never overflows: the old size fit in MaxAllocSize, and the new size is * just a small constant larger. */ - size = offsetof(POLYGON, p) +sizeof(poly->p[0]) * path->npts; + size = offsetof(POLYGON, p) + sizeof(poly->p[0]) * path->npts; poly = (POLYGON *) palloc(size); SET_VARSIZE(poly, size); @@ -4460,7 +4460,7 @@ box_poly(PG_FUNCTION_ARGS) int size; /* map four corners of the box to a polygon */ - size = offsetof(POLYGON, p) +sizeof(poly->p[0]) * 4; + size = offsetof(POLYGON, p) + sizeof(poly->p[0]) * 4; poly = (POLYGON *) palloc(size); SET_VARSIZE(poly, size); @@ -4494,7 +4494,7 @@ poly_path(PG_FUNCTION_ARGS) * Never overflows: the old size fit in MaxAllocSize, and the new size is * smaller by a small constant. */ - size = offsetof(PATH, p) +sizeof(path->p[0]) * poly->npts; + size = offsetof(PATH, p) + sizeof(path->p[0]) * poly->npts; path = (PATH *) palloc(size); SET_VARSIZE(path, size); @@ -5172,7 +5172,7 @@ circle_poly(PG_FUNCTION_ARGS) errmsg("must request at least 2 points"))); base_size = sizeof(poly->p[0]) * npts; - size = offsetof(POLYGON, p) +base_size; + size = offsetof(POLYGON, p) + base_size; /* Check for integer overflow */ if (base_size / npts != sizeof(poly->p[0]) || size <= base_size) diff --git a/src/backend/utils/adt/int.c b/src/backend/utils/adt/int.c index bd4422e08a1..96ef25b900e 100644 --- a/src/backend/utils/adt/int.c +++ b/src/backend/utils/adt/int.c @@ -822,7 +822,7 @@ int2mul(PG_FUNCTION_ARGS) * The most practical way to detect overflow is to do the arithmetic in * int32 (so that the result can't overflow) and then do a range check. */ - result32 = (int32) arg1 *(int32) arg2; + result32 = (int32) arg1 * (int32) arg2; if (result32 < SHRT_MIN || result32 > SHRT_MAX) ereport(ERROR, diff --git a/src/backend/utils/adt/jsonb.c b/src/backend/utils/adt/jsonb.c index e256eaf55e5..3e206c21213 100644 --- a/src/backend/utils/adt/jsonb.c +++ b/src/backend/utils/adt/jsonb.c @@ -1661,7 +1661,7 @@ jsonb_agg_transfn(PG_FUNCTION_ARGS) { /* same for numeric */ v.val.numeric = - DatumGetNumeric(DirectFunctionCall1(numeric_uplus, + DatumGetNumeric(DirectFunctionCall1(numeric_uplus, NumericGetDatum(v.val.numeric))); } result->res = pushJsonbValue(&result->parseState, @@ -1891,7 +1891,7 @@ jsonb_object_agg_transfn(PG_FUNCTION_ARGS) { /* same for numeric */ v.val.numeric = - DatumGetNumeric(DirectFunctionCall1(numeric_uplus, + DatumGetNumeric(DirectFunctionCall1(numeric_uplus, NumericGetDatum(v.val.numeric))); } result->res = pushJsonbValue(&result->parseState, diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index d7ece68c18d..01df06ebfdb 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -84,7 +84,8 @@ typedef struct GetState char **path_names; /* field name(s) being sought */ int *path_indexes; /* array index(es) being sought */ bool *pathok; /* is path matched to current depth? */ - int *array_cur_index; /* current element index at each path level */ + int *array_cur_index; /* current element index at each path + * level */ } GetState; /* state for json_array_length */ diff --git a/src/backend/utils/adt/like_match.c b/src/backend/utils/adt/like_match.c index 1c37229e09f..634953ae672 100644 --- a/src/backend/utils/adt/like_match.c +++ b/src/backend/utils/adt/like_match.c @@ -236,7 +236,7 @@ MatchText(char *t, int tlen, char *p, int plen, * matching this pattern. */ return LIKE_ABORT; -} /* MatchText() */ +} /* MatchText() */ /* * like_escape() --- given a pattern and an ESCAPE string, diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 3f6a9d3b828..38dc1266e04 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -71,8 +71,8 @@ * Function prototypes -- internal to this file only */ -static AbsoluteTime tm2abstime(struct pg_tm * tm, int tz); -static void reltime2tm(RelativeTime time, struct pg_tm * tm); +static AbsoluteTime tm2abstime(struct pg_tm *tm, int tz); +static void reltime2tm(RelativeTime time, struct pg_tm *tm); static void parsetinterval(char *i_string, AbsoluteTime *i_start, AbsoluteTime *i_end); @@ -96,7 +96,7 @@ GetCurrentAbsoluteTime(void) void -abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn) +abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm *tm, char **tzn) { pg_time_t time = (pg_time_t) _time; struct pg_tm *tx; @@ -148,7 +148,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn) * Note that tm has full year (not 1900-based) and 1-based month. */ static AbsoluteTime -tm2abstime(struct pg_tm * tm, int tz) +tm2abstime(struct pg_tm *tm, int tz) { int day; AbsoluteTime sec; @@ -680,7 +680,7 @@ reltimesend(PG_FUNCTION_ARGS) static void -reltime2tm(RelativeTime time, struct pg_tm * tm) +reltime2tm(RelativeTime time, struct pg_tm *tm) { double dtime = time; diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 24ae3c6886e..a2855984d51 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -390,7 +390,7 @@ assign_locale_messages(const char *newval, void *extra) * itself.) It's important that this not throw elog(ERROR). */ static void -free_struct_lconv(struct lconv * s) +free_struct_lconv(struct lconv *s) { if (s->decimal_point) free(s->decimal_point); @@ -419,7 +419,7 @@ free_struct_lconv(struct lconv * s) * about) are non-NULL. The field list must match free_struct_lconv(). */ static bool -struct_lconv_is_valid(struct lconv * s) +struct_lconv_is_valid(struct lconv *s) { if (s->decimal_point == NULL) return false; @@ -705,7 +705,7 @@ PGLC_localeconv(void) */ static size_t strftime_win32(char *dst, size_t dstlen, - const char *format, const struct tm * tm) + const char *format, const struct tm *tm) { size_t len; wchar_t wformat[8]; /* formats used below need 3 bytes */ @@ -756,7 +756,7 @@ strftime_win32(char *dst, size_t dstlen, /* Subroutine for cache_locale_time(). */ static void -cache_single_time(char **dst, const char *format, const struct tm * tm) +cache_single_time(char **dst, const char *format, const struct tm *tm) { char buf[MAX_L10N_DATA]; char *ptr; diff --git a/src/backend/utils/adt/rangetypes.c b/src/backend/utils/adt/rangetypes.c index 304345b9044..94a77c9b6a3 100644 --- a/src/backend/utils/adt/rangetypes.c +++ b/src/backend/utils/adt/rangetypes.c @@ -2051,7 +2051,7 @@ range_parse(const char *string, char *flags, char **lbound_str, } else if (*ptr == ')') ptr++; - else /* must be a comma */ + else /* must be a comma */ ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg("malformed range literal: \"%s\"", diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 6a0d273bd26..5f3f7968d55 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -1260,7 +1260,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno, quote_identifier(NameStr(idxrelrec->relname)), generate_relation_name(indrelid, NIL), quote_identifier(NameStr(amrec->amname))); - else /* currently, must be EXCLUDE constraint */ + else /* currently, must be EXCLUDE constraint */ appendStringInfo(&buf, "EXCLUDE USING %s (", quote_identifier(NameStr(amrec->amname))); } @@ -7374,17 +7374,17 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags) return false; return true; /* own parentheses */ } - case T_BoolExpr: /* lower precedence */ - case T_ArrayRef: /* other separators */ + case T_BoolExpr: /* lower precedence */ + case T_ArrayRef: /* other separators */ case T_ArrayExpr: /* other separators */ - case T_RowExpr: /* other separators */ + case T_RowExpr: /* other separators */ case T_CoalesceExpr: /* own parentheses */ case T_MinMaxExpr: /* own parentheses */ - case T_XmlExpr: /* own parentheses */ + case T_XmlExpr: /* own parentheses */ case T_NullIfExpr: /* other separators */ case T_Aggref: /* own parentheses */ case T_WindowFunc: /* own parentheses */ - case T_CaseExpr: /* other separators */ + case T_CaseExpr: /* other separators */ return true; default: return false; @@ -7425,16 +7425,16 @@ isSimpleNode(Node *node, Node *parentNode, int prettyFlags) return false; return true; /* own parentheses */ } - case T_ArrayRef: /* other separators */ + case T_ArrayRef: /* other separators */ case T_ArrayExpr: /* other separators */ - case T_RowExpr: /* other separators */ + case T_RowExpr: /* other separators */ case T_CoalesceExpr: /* own parentheses */ case T_MinMaxExpr: /* own parentheses */ - case T_XmlExpr: /* own parentheses */ + case T_XmlExpr: /* own parentheses */ case T_NullIfExpr: /* other separators */ case T_Aggref: /* own parentheses */ case T_WindowFunc: /* own parentheses */ - case T_CaseExpr: /* other separators */ + case T_CaseExpr: /* other separators */ return true; default: return false; diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 22dabf59af2..33788a2b364 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -4205,7 +4205,7 @@ convert_string_datum(Datum value, Oid typid) { char *xfrmstr; size_t xfrmlen; - size_t xfrmlen2 PG_USED_FOR_ASSERTS_ONLY; + size_t xfrmlen2 PG_USED_FOR_ASSERTS_ONLY; /* * XXX: We could guess at a suitable output buffer size and only call @@ -4221,7 +4221,8 @@ convert_string_datum(Datum value, Oid typid) /* * * http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx? - * FeedbackID=99694 */ + * FeedbackID=99694 + */ { char x[1]; diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 3f6e0d4497b..d477e235507 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -455,7 +455,7 @@ timestamptz_in(PG_FUNCTION_ARGS) * don't care, so we don't bother being consistent. */ static int -parse_sane_timezone(struct pg_tm * tm, text *zone) +parse_sane_timezone(struct pg_tm *tm, text *zone) { char tzname[TZ_STRLEN_MAX + 1]; int rt; @@ -1526,7 +1526,7 @@ EncodeSpecialTimestamp(Timestamp dt, char *str) strcpy(str, EARLY); else if (TIMESTAMP_IS_NOEND(dt)) strcpy(str, LATE); - else /* shouldn't happen */ + else /* shouldn't happen */ elog(ERROR, "invalid argument for EncodeSpecialTimestamp"); } @@ -1740,7 +1740,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec) time -= (*min) * USECS_PER_MINUTE; *sec = time / USECS_PER_SEC; *fsec = time - (*sec * USECS_PER_SEC); -} /* dt2time() */ +} /* dt2time() */ /* @@ -1755,7 +1755,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec) * If attimezone is NULL, the global timezone setting will be used. */ int -timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone) +timestamp2tm(Timestamp dt, int *tzp, struct pg_tm *tm, fsec_t *fsec, const char **tzn, pg_tz *attimezone) { Timestamp date; Timestamp time; @@ -1851,7 +1851,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, const char * Returns -1 on failure (value out of range). */ int -tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result) +tm2timestamp(struct pg_tm *tm, fsec_t fsec, int *tzp, Timestamp *result) { TimeOffset date; TimeOffset time; @@ -1899,7 +1899,7 @@ tm2timestamp(struct pg_tm * tm, fsec_t fsec, int *tzp, Timestamp *result) * Convert an interval data type to a tm structure. */ int -interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec) +interval2tm(Interval span, struct pg_tm *tm, fsec_t *fsec) { TimeOffset time; TimeOffset tfrac; @@ -1927,7 +1927,7 @@ interval2tm(Interval span, struct pg_tm * tm, fsec_t *fsec) } int -tm2interval(struct pg_tm * tm, fsec_t fsec, Interval *span) +tm2interval(struct pg_tm *tm, fsec_t fsec, Interval *span) { double total_months = (double) tm->tm_year * MONTHS_PER_YEAR + tm->tm_mon; @@ -1981,7 +1981,7 @@ interval_finite(PG_FUNCTION_ARGS) *---------------------------------------------------------*/ void -GetEpochTime(struct pg_tm * tm) +GetEpochTime(struct pg_tm *tm) { struct pg_tm *t0; pg_time_t epoch = 0; @@ -2011,7 +2011,7 @@ SetEpochTimestamp(void) tm2timestamp(tm, 0, NULL, &dt); return dt; -} /* SetEpochTimestamp() */ +} /* SetEpochTimestamp() */ /* * We are currently sharing some code between timestamp and timestamptz. @@ -4930,7 +4930,7 @@ timestamp_izone(PG_FUNCTION_ARGS) errmsg("timestamp out of range"))); PG_RETURN_TIMESTAMPTZ(result); -} /* timestamp_izone() */ +} /* timestamp_izone() */ /* timestamp_timestamptz() * Convert local timestamp to timestamp at GMT diff --git a/src/backend/utils/adt/tsquery.c b/src/backend/utils/adt/tsquery.c index 3e2fc6e9dfa..41e1ecd70f2 100644 --- a/src/backend/utils/adt/tsquery.c +++ b/src/backend/utils/adt/tsquery.c @@ -1015,7 +1015,8 @@ tsqueryrecv(PG_FUNCTION_ARGS) if (item->type == QI_VAL) { - size_t val_len; /* length after recoding to server encoding */ + size_t val_len; /* length after recoding to server + * encoding */ uint8 weight; uint8 prefix; const char *val; diff --git a/src/backend/utils/adt/tsrank.c b/src/backend/utils/adt/tsrank.c index 76e5e541b63..a41eb1fa9c4 100644 --- a/src/backend/utils/adt/tsrank.c +++ b/src/backend/utils/adt/tsrank.c @@ -910,7 +910,7 @@ calc_rank_cd(const float4 *arrdata, TSVector txt, TSQuery query, int method) CurExtPos = ((double) (ext.q + ext.p)) / 2.0; if (NExtent > 0 && CurExtPos > PrevExtPos /* prevent division by * zero in a case of - multiple lexize */ ) + * multiple lexize */ ) SumDist += 1.0 / (CurExtPos - PrevExtPos); PrevExtPos = CurExtPos; diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index c694637c8fd..89aa0f1b32b 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -411,7 +411,7 @@ tsvector_bsearch(const TSVector tsv, char *lexeme, int lexeme_len) StopHigh = StopMiddle; else if (cmp > 0) StopLow = StopMiddle + 1; - else /* found it */ + else /* found it */ return StopMiddle; } @@ -1058,7 +1058,7 @@ tsvector_concat(PG_FUNCTION_ARGS) if (ptr2->haspos) dataoff += add_pos(in2, ptr2, out, ptr, maxpos) * sizeof(WordEntryPos); } - else /* must have ptr2->haspos */ + else /* must have ptr2->haspos */ { int addlen = add_pos(in2, ptr2, out, ptr, maxpos); @@ -1255,7 +1255,7 @@ checkclass_str(CHKVAL *chkval, WordEntry *entry, QueryOperand *val, posvec_iter++; } } - else /* data != NULL */ + else /* data != NULL */ { data->npos = posvec->npos; data->pos = posvec->pos; @@ -1489,7 +1489,7 @@ TS_phrase_output(ExecPhraseData *data, Lindex++; Rindex++; } - else /* Lpos > Rpos */ + else /* Lpos > Rpos */ { /* Rpos is not matched in Ldata, should we output it? */ if (emit & TSPO_R_ONLY) diff --git a/src/backend/utils/adt/tsvector_parser.c b/src/backend/utils/adt/tsvector_parser.c index 2680114f7c9..060d073fb71 100644 --- a/src/backend/utils/adt/tsvector_parser.c +++ b/src/backend/utils/adt/tsvector_parser.c @@ -363,7 +363,7 @@ gettoken_tsvector(TSVectorParseState state, else if (!t_isdigit(state->prsbuf)) PRSSYNTAXERROR; } - else /* internal error */ + else /* internal error */ elog(ERROR, "unrecognized state in gettoken_tsvector: %d", statecode); diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index 5fe82400e72..cb1fd4d9cef 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -221,7 +221,7 @@ text_to_cstring_buffer(const text *src, char *dst, size_t dst_len) dst_len--; if (dst_len >= src_len) dst_len = src_len; - else /* ensure truncation is encoding-safe */ + else /* ensure truncation is encoding-safe */ dst_len = pg_mbcliplen(VARDATA_ANY(srcunpacked), src_len, dst_len); memcpy(dst, VARDATA_ANY(srcunpacked), dst_len); dst[dst_len] = '\0'; diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c index b19044c46ca..74bfd56169a 100644 --- a/src/backend/utils/cache/catcache.c +++ b/src/backend/utils/cache/catcache.c @@ -1571,7 +1571,7 @@ SearchCatCacheList(CatCache *cache, oldcxt = MemoryContextSwitchTo(CacheMemoryContext); nmembers = list_length(ctlist); cl = (CatCList *) - palloc(offsetof(CatCList, members) +nmembers * sizeof(CatCTup *)); + palloc(offsetof(CatCList, members) + nmembers * sizeof(CatCTup *)); heap_copytuple_with_tuple(ntp, &cl->tuple); MemoryContextSwitchTo(oldcxt); heap_freetuple(ntp); diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index 819121638ea..055705136a9 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -194,7 +194,7 @@ static struct SYSCACHECALLBACK int16 link; /* next callback index+1 for same cache */ SyscacheCallbackFunction function; Datum arg; -} syscache_callback_list[MAX_SYSCACHE_CALLBACKS]; +} syscache_callback_list[MAX_SYSCACHE_CALLBACKS]; static int16 syscache_callback_links[SysCacheSize]; @@ -204,7 +204,7 @@ static struct RELCACHECALLBACK { RelcacheCallbackFunction function; Datum arg; -} relcache_callback_list[MAX_RELCACHE_CALLBACKS]; +} relcache_callback_list[MAX_RELCACHE_CALLBACKS]; static int relcache_callback_count = 0; diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c index 0cf5001a758..6ba199b40df 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -888,8 +888,8 @@ load_domaintype_info(TypeCacheEntry *typentry) static int dcs_cmp(const void *a, const void *b) { - const DomainConstraintState *const * ca = (const DomainConstraintState *const *) a; - const DomainConstraintState *const * cb = (const DomainConstraintState *const *) b; + const DomainConstraintState *const *ca = (const DomainConstraintState *const *) a; + const DomainConstraintState *const *cb = (const DomainConstraintState *const *) b; return strcmp((*ca)->name, (*cb)->name); } diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 22004cb8192..cad75c80d8f 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -627,7 +627,7 @@ errcode_for_file_access(void) case ENOTDIR: /* Not a directory */ case EISDIR: /* Is a directory */ #if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) /* same code on AIX */ - case ENOTEMPTY: /* Directory not empty */ + case ENOTEMPTY: /* Directory not empty */ #endif edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE; break; diff --git a/src/backend/utils/fmgr/dfmgr.c b/src/backend/utils/fmgr/dfmgr.c index 28c2583f960..bfd1b118500 100644 --- a/src/backend/utils/fmgr/dfmgr.c +++ b/src/backend/utils/fmgr/dfmgr.c @@ -214,7 +214,7 @@ internal_load_library(const char *libname) * File not loaded yet. */ file_scanner = (DynamicFileList *) - malloc(offsetof(DynamicFileList, filename) +strlen(libname) + 1); + malloc(offsetof(DynamicFileList, filename) + strlen(libname) + 1); if (file_scanner == NULL) ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY), diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index f6d2b7d63ee..0382c158c54 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -1828,7 +1828,7 @@ Float8GetDatum(float8 X) */ struct varlena * -pg_detoast_datum(struct varlena * datum) +pg_detoast_datum(struct varlena *datum) { if (VARATT_IS_EXTENDED(datum)) return heap_tuple_untoast_attr(datum); @@ -1837,7 +1837,7 @@ pg_detoast_datum(struct varlena * datum) } struct varlena * -pg_detoast_datum_copy(struct varlena * datum) +pg_detoast_datum_copy(struct varlena *datum) { if (VARATT_IS_EXTENDED(datum)) return heap_tuple_untoast_attr(datum); @@ -1853,14 +1853,14 @@ pg_detoast_datum_copy(struct varlena * datum) } struct varlena * -pg_detoast_datum_slice(struct varlena * datum, int32 first, int32 count) +pg_detoast_datum_slice(struct varlena *datum, int32 first, int32 count) { /* Only get the specified portion from the toast rel */ return heap_tuple_untoast_attr_slice(datum, first, count); } struct varlena * -pg_detoast_datum_packed(struct varlena * datum) +pg_detoast_datum_packed(struct varlena *datum) { if (VARATT_IS_COMPRESSED(datum) || VARATT_IS_EXTERNAL(datum)) return heap_tuple_untoast_attr(datum); diff --git a/src/backend/utils/hash/dynahash.c b/src/backend/utils/hash/dynahash.c index 1adc5841f73..578b1daccf2 100644 --- a/src/backend/utils/hash/dynahash.c +++ b/src/backend/utils/hash/dynahash.c @@ -331,7 +331,7 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags) } /* Initialize the hash header, plus a copy of the table name */ - hashp = (HTAB *) DynaHashAlloc(sizeof(HTAB) + strlen(tabname) +1); + hashp = (HTAB *) DynaHashAlloc(sizeof(HTAB) + strlen(tabname) + 1); MemSet(hashp, 0, sizeof(HTAB)); hashp->tabname = (char *) (hashp + 1); diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c index fd51eedf7c6..9334039f78c 100644 --- a/src/backend/utils/mb/wchar.c +++ b/src/backend/utils/mb/wchar.c @@ -98,7 +98,7 @@ pg_euc2wchar_with_len(const unsigned char *from, pg_wchar *to, int len) *to |= *from++; len -= 2; } - else /* must be ASCII */ + else /* must be ASCII */ { *to = *from++; len--; @@ -581,7 +581,7 @@ struct mbinterval /* auxiliary function for binary search in interval table */ static int -mbbisearch(pg_wchar ucs, const struct mbinterval * table, int max) +mbbisearch(pg_wchar ucs, const struct mbinterval *table, int max) { int min = 0; int mid; diff --git a/src/backend/utils/misc/backend_random.c b/src/backend/utils/misc/backend_random.c index d8556143dcd..9a0b2ce9ebc 100644 --- a/src/backend/utils/misc/backend_random.c +++ b/src/backend/utils/misc/backend_random.c @@ -69,9 +69,9 @@ typedef struct { bool initialized; unsigned short seed[3]; -} BackendRandomShmemStruct; +} BackendRandomShmemStruct; -static BackendRandomShmemStruct *BackendRandomShmem; +static BackendRandomShmemStruct * BackendRandomShmem; Size BackendRandomShmemSize(void) diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 92e1d63b2f5..d9469e4181d 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -136,15 +136,15 @@ static void do_serialize(char **destptr, Size *maxbytes, const char *fmt,...) pg static void set_config_sourcefile(const char *name, char *sourcefile, int sourceline); -static bool call_bool_check_hook(struct config_bool * conf, bool *newval, +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, +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, +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, +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, +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); @@ -3951,17 +3951,17 @@ static int GUCNestLevel = 0; /* 1 when in main transaction */ static int guc_var_compare(const void *a, const void *b); static int guc_name_compare(const char *namea, const char *nameb); static void InitializeGUCOptionsFromEnvironment(void); -static void InitializeOneGUCOption(struct config_generic * gconf); -static void push_old_value(struct config_generic * gconf, GucAction action); -static void ReportGUCOption(struct config_generic * record); -static void reapply_stacked_values(struct config_generic * variable, - struct config_string * pHolder, +static void InitializeOneGUCOption(struct config_generic *gconf); +static void push_old_value(struct config_generic *gconf, GucAction action); +static void ReportGUCOption(struct config_generic *record); +static void reapply_stacked_values(struct config_generic *variable, + struct config_string *pHolder, GucStack *stack, const char *curvalue, GucContext curscontext, GucSource cursource); static void ShowGUCConfigOption(const char *name, DestReceiver *dest); static void ShowAllGUCConfig(DestReceiver *dest); -static char *_ShowOption(struct config_generic * record, bool use_units); +static char *_ShowOption(struct config_generic *record, bool use_units); static bool validate_option_array_item(const char *name, const char *value, bool skipIfNoPermissions); static void write_auto_conf_file(int fd, const char *filename, ConfigVariable *head_p); @@ -4022,7 +4022,7 @@ guc_strdup(int elevel, const char *src) * Detect whether strval is referenced anywhere in a GUC string item */ static bool -string_field_used(struct config_string * conf, char *strval) +string_field_used(struct config_string *conf, char *strval) { GucStack *stack; @@ -4045,7 +4045,7 @@ string_field_used(struct config_string * conf, char *strval) * states). */ static void -set_string_field(struct config_string * conf, char **field, char *newval) +set_string_field(struct config_string *conf, char **field, char *newval) { char *oldval = *field; @@ -4061,7 +4061,7 @@ set_string_field(struct config_string * conf, char **field, char *newval) * Detect whether an "extra" struct is referenced anywhere in a GUC item */ static bool -extra_field_used(struct config_generic * gconf, void *extra) +extra_field_used(struct config_generic *gconf, void *extra) { GucStack *stack; @@ -4106,7 +4106,7 @@ extra_field_used(struct config_generic * gconf, void *extra) * states). */ static void -set_extra_field(struct config_generic * gconf, void **field, void *newval) +set_extra_field(struct config_generic *gconf, void **field, void *newval) { void *oldval = *field; @@ -4126,7 +4126,7 @@ set_extra_field(struct config_generic * gconf, void **field, void *newval) * initialized to NULL before this is used, else we'll try to free() them. */ static void -set_stack_value(struct config_generic * gconf, config_var_value *val) +set_stack_value(struct config_generic *gconf, config_var_value *val) { switch (gconf->vartype) { @@ -4160,7 +4160,7 @@ set_stack_value(struct config_generic * gconf, config_var_value *val) * The "extra" field associated with the stack entry is cleared, too. */ static void -discard_stack_value(struct config_generic * gconf, config_var_value *val) +discard_stack_value(struct config_generic *gconf, config_var_value *val) { switch (gconf->vartype) { @@ -4283,7 +4283,7 @@ build_guc_variables(void) * list is expanded if needed. */ static bool -add_guc_variable(struct config_generic * var, int elevel) +add_guc_variable(struct config_generic *var, int elevel) { if (num_guc_variables + 1 >= size_guc_variables) { @@ -4420,8 +4420,8 @@ find_option(const char *name, bool create_placeholders, int elevel) static int guc_var_compare(const void *a, const void *b) { - const struct config_generic *confa = *(struct config_generic * const *) a; - const struct config_generic *confb = *(struct config_generic * const *) b; + const struct config_generic *confa = *(struct config_generic *const *) a; + const struct config_generic *confb = *(struct config_generic *const *) b; return guc_name_compare(confa->name, confb->name); } @@ -4566,7 +4566,7 @@ InitializeGUCOptionsFromEnvironment(void) * might fail, but that the hooks might wish to compute an "extra" struct. */ static void -InitializeOneGUCOption(struct config_generic * gconf) +InitializeOneGUCOption(struct config_generic *gconf) { gconf->status = 0; gconf->source = PGC_S_DEFAULT; @@ -4961,7 +4961,7 @@ ResetAllOptions(void) * Push previous state during transactional assignment to a GUC variable. */ static void -push_old_value(struct config_generic * gconf, GucAction action) +push_old_value(struct config_generic *gconf, GucAction action) { GucStack *stack; @@ -5138,7 +5138,7 @@ AtEOXact_GUC(bool isCommit, int nestLevel) /* we keep the current active value */ discard_stack_value(gconf, &stack->prior); } - else /* must be GUC_LOCAL */ + else /* must be GUC_LOCAL */ restorePrior = true; } else if (prev == NULL || @@ -5385,7 +5385,7 @@ BeginReportingGUCOptions(void) * ReportGUCOption: if appropriate, transmit option value to frontend */ static void -ReportGUCOption(struct config_generic * record) +ReportGUCOption(struct config_generic *record) { if (reporting_enabled && (record->flags & GUC_REPORT)) { @@ -5614,7 +5614,7 @@ parse_real(const char *value, double *result) * allocated for modification. */ const char * -config_enum_lookup_by_value(struct config_enum * record, int val) +config_enum_lookup_by_value(struct config_enum *record, int val) { const struct config_enum_entry *entry; @@ -5637,7 +5637,7 @@ config_enum_lookup_by_value(struct config_enum * record, int val) * true. If it's not found, return FALSE and retval is set to 0. */ bool -config_enum_lookup_by_name(struct config_enum * record, const char *value, +config_enum_lookup_by_name(struct config_enum *record, const char *value, int *retval) { const struct config_enum_entry *entry; @@ -5663,7 +5663,7 @@ config_enum_lookup_by_name(struct config_enum * record, const char *value, * If suffix is non-NULL, it is added to the end of the string. */ static char * -config_enum_get_options(struct config_enum * record, const char *prefix, +config_enum_get_options(struct config_enum *record, const char *prefix, const char *suffix, const char *separator) { const struct config_enum_entry *entry; @@ -5721,10 +5721,10 @@ config_enum_get_options(struct config_enum * record, const char *prefix, * Returns true if OK, false if not (or throws error, if elevel >= ERROR) */ static bool -parse_and_validate_value(struct config_generic * record, +parse_and_validate_value(struct config_generic *record, const char *name, const char *value, GucSource source, int elevel, - union config_var_val * newval, void **newextra) + union config_var_val *newval, void **newextra) { switch (record->vartype) { @@ -7545,7 +7545,7 @@ init_custom_variable(const char *name, * variable into the GUC variable array, replacing any placeholder. */ static void -define_custom_variable(struct config_generic * variable) +define_custom_variable(struct config_generic *variable) { const char *name = variable->name; const char **nameAddr = &name; @@ -7645,8 +7645,8 @@ define_custom_variable(struct config_generic * variable) * fashion implied by the stack entry. */ static void -reapply_stacked_values(struct config_generic * variable, - struct config_string * pHolder, +reapply_stacked_values(struct config_generic *variable, + struct config_string *pHolder, GucStack *stack, const char *curvalue, GucContext curscontext, GucSource cursource) @@ -7842,7 +7842,7 @@ DefineCustomEnumVariable(const char *name, const char *long_desc, int *valueAddr, int bootValue, - const struct config_enum_entry * options, + const struct config_enum_entry *options, GucContext context, int flags, GucEnumCheckHook check_hook, @@ -8630,7 +8630,7 @@ show_all_file_settings(PG_FUNCTION_ARGS) } static char * -_ShowOption(struct config_generic * record, bool use_units) +_ShowOption(struct config_generic *record, bool use_units) { char buffer[256]; const char *val; @@ -8741,7 +8741,7 @@ _ShowOption(struct config_generic * record, bool use_units) * variable scontext, integer */ static void -write_one_nondefault_variable(FILE *fp, struct config_generic * gconf) +write_one_nondefault_variable(FILE *fp, struct config_generic *gconf) { if (gconf->source == PGC_S_DEFAULT) return; @@ -8977,7 +8977,7 @@ read_nondefault_variables(void) * never sends these, and RestoreGUCState() never changes them. */ static bool -can_skip_gucvar(struct config_generic * gconf) +can_skip_gucvar(struct config_generic *gconf) { return gconf->context == PGC_POSTMASTER || gconf->context == PGC_INTERNAL || gconf->source == PGC_S_DEFAULT; @@ -8990,7 +8990,7 @@ can_skip_gucvar(struct config_generic * gconf) * It's OK to overestimate, but not to underestimate. */ static Size -estimate_variable_size(struct config_generic * gconf) +estimate_variable_size(struct config_generic *gconf) { Size size; Size valsize = 0; @@ -9162,7 +9162,7 @@ do_serialize_binary(char **destptr, Size *maxbytes, void *val, Size valsize) */ static void serialize_variable(char **destptr, Size *maxbytes, - struct config_generic * gconf) + struct config_generic *gconf) { if (can_skip_gucvar(gconf)) return; @@ -9783,7 +9783,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 */ @@ -9817,7 +9817,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 */ @@ -9851,7 +9851,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 */ @@ -9885,7 +9885,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 */ @@ -9919,7 +9919,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 */ diff --git a/src/backend/utils/mmgr/aset.c b/src/backend/utils/mmgr/aset.c index 45d793c1e86..9d8f02a1799 100644 --- a/src/backend/utils/mmgr/aset.c +++ b/src/backend/utils/mmgr/aset.c @@ -152,7 +152,7 @@ typedef struct AllocBlockData AllocBlock next; /* next block in aset's blocks list, if any */ char *freeptr; /* start of free space in this block */ char *endptr; /* end of space in this block */ -} AllocBlockData; +} AllocBlockData; /* * AllocChunk @@ -176,7 +176,7 @@ typedef struct AllocChunkData void *aset; /* there must not be any padding to reach a MAXALIGN boundary here! */ -} AllocChunkData; +} AllocChunkData; /* * AllocPointerIsValid diff --git a/src/backend/utils/mmgr/slab.c b/src/backend/utils/mmgr/slab.c index e59154ddda4..2cf58059d03 100644 --- a/src/backend/utils/mmgr/slab.c +++ b/src/backend/utils/mmgr/slab.c @@ -190,7 +190,7 @@ SlabContextCreate(MemoryContext parent, Size freelistSize; SlabContext *slab; - StaticAssertStmt(offsetof(SlabChunk, slab) +sizeof(MemoryContext) == + StaticAssertStmt(offsetof(SlabChunk, slab) + sizeof(MemoryContext) == MAXALIGN(sizeof(SlabChunk)), "padding calculation in SlabChunk is wrong"); @@ -221,7 +221,7 @@ SlabContextCreate(MemoryContext parent, /* Do the type-independent part of context creation */ slab = (SlabContext *) MemoryContextCreate(T_SlabContext, - (offsetof(SlabContext, freelist) +freelistSize), + (offsetof(SlabContext, freelist) + freelistSize), &SlabMethods, parent, name); diff --git a/src/backend/utils/resowner/resowner.c b/src/backend/utils/resowner/resowner.c index af46d781253..8f324cd5804 100644 --- a/src/backend/utils/resowner/resowner.c +++ b/src/backend/utils/resowner/resowner.c @@ -128,7 +128,7 @@ typedef struct ResourceOwnerData /* We can remember up to MAX_RESOWNER_LOCKS references to local locks. */ int nlocks; /* number of owned locks */ LOCALLOCK *locks[MAX_RESOWNER_LOCKS]; /* list of owned locks */ -} ResourceOwnerData; +} ResourceOwnerData; /***************************************************************************** diff --git a/src/backend/utils/sort/tuplesort.c b/src/backend/utils/sort/tuplesort.c index 8a8db0fd337..5614d970bd6 100644 --- a/src/backend/utils/sort/tuplesort.c +++ b/src/backend/utils/sort/tuplesort.c @@ -263,7 +263,7 @@ typedef enum #define RUN_SECOND 1 typedef int (*SortTupleComparator) (const SortTuple *a, const SortTuple *b, - Tuplesortstate *state); + Tuplesortstate *state); /* * Private state of a Tuplesort operation. @@ -314,7 +314,7 @@ struct Tuplesortstate * memory space thereby released. */ void (*writetup) (Tuplesortstate *state, int tapenum, - SortTuple *stup); + SortTuple *stup); /* * Function to read a stored tuple from tape back into memory. 'len' is @@ -322,7 +322,7 @@ struct Tuplesortstate * from the slab memory arena, or is palloc'd, see readtup_alloc(). */ void (*readtup) (Tuplesortstate *state, SortTuple *stup, - int tapenum, unsigned int len); + int tapenum, unsigned int len); /* * This array holds the tuples now in sort memory. If we are in state @@ -2391,7 +2391,7 @@ inittapes(Tuplesortstate *state) * case it's not important to account for tuple space, so we don't care if * LACKMEM becomes inaccurate.) */ - tapeSpace = (int64) maxTapes *TAPE_BUFFER_OVERHEAD; + tapeSpace = (int64) maxTapes * TAPE_BUFFER_OVERHEAD; if (tapeSpace + GetMemoryChunkSpace(state->memtuples) < state->allowedMem) USEMEM(state, tapeSpace); |