aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/formatting.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/formatting.c')
-rw-r--r--src/backend/utils/adt/formatting.c63
1 files changed, 37 insertions, 26 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 1e21dd5c689..4127bece12a 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -1449,10 +1449,10 @@ 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);
+typedef int32_t (*ICU_Convert_Func) (UChar *dest, int32_t destCapacity,
+ 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,
@@ -1461,7 +1461,7 @@ icu_convert_case(ICU_Convert_Func func, pg_locale_t mylocale,
UErrorCode status;
int32_t len_dest;
- len_dest = len_source; /* try first with same length */
+ len_dest = len_source; /* try first with same length */
*buff_dest = palloc(len_dest * sizeof(**buff_dest));
status = U_ZERO_ERROR;
len_dest = func(*buff_dest, len_dest, buff_source, len_source,
@@ -1491,7 +1491,7 @@ u_strToTitle_default_BI(UChar *dest, int32_t destCapacity,
NULL, locale, pErrorCode);
}
-#endif /* USE_ICU */
+#endif /* USE_ICU */
/*
* If the system provides the needed functions for wide-character manipulation
@@ -1592,7 +1592,10 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
workspace[curr_char] = towlower(workspace[curr_char]);
}
- /* Make result large enough; case change might change number of bytes */
+ /*
+ * Make result large enough; case change might change number
+ * of bytes
+ */
result_size = curr_char * pg_database_encoding_max_length() + 1;
result = palloc(result_size);
@@ -1607,11 +1610,11 @@ str_tolower(const char *buff, size_t nbytes, Oid collid)
result = pnstrdup(buff, nbytes);
/*
- * Note: we assume that tolower_l() will not be so broken as to need
- * an isupper_l() guard test. 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.
+ * Note: we assume that tolower_l() will not be so broken as
+ * to need an isupper_l() guard test. 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.
*/
for (p = result; *p; p++)
{
@@ -1672,7 +1675,8 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
#ifdef USE_ICU
if (mylocale && mylocale->provider == COLLPROVIDER_ICU)
{
- int32_t len_uchar, len_conv;
+ int32_t len_uchar,
+ len_conv;
UChar *buff_uchar;
UChar *buff_conv;
@@ -1711,7 +1715,10 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
workspace[curr_char] = towupper(workspace[curr_char]);
}
- /* Make result large enough; case change might change number of bytes */
+ /*
+ * Make result large enough; case change might change number
+ * of bytes
+ */
result_size = curr_char * pg_database_encoding_max_length() + 1;
result = palloc(result_size);
@@ -1726,11 +1733,11 @@ str_toupper(const char *buff, size_t nbytes, Oid collid)
result = pnstrdup(buff, nbytes);
/*
- * Note: we assume that toupper_l() will not be so broken as to need
- * an islower_l() guard test. 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.
+ * Note: we assume that toupper_l() will not be so broken as
+ * to need an islower_l() guard test. 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.
*/
for (p = result; *p; p++)
{
@@ -1792,7 +1799,8 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
#ifdef USE_ICU
if (mylocale && mylocale->provider == COLLPROVIDER_ICU)
{
- int32_t len_uchar, len_conv;
+ int32_t len_uchar,
+ len_conv;
UChar *buff_uchar;
UChar *buff_conv;
@@ -1843,7 +1851,10 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
}
}
- /* Make result large enough; case change might change number of bytes */
+ /*
+ * Make result large enough; case change might change number
+ * of bytes
+ */
result_size = curr_char * pg_database_encoding_max_length() + 1;
result = palloc(result_size);
@@ -1858,11 +1869,11 @@ str_initcap(const char *buff, size_t nbytes, Oid collid)
result = pnstrdup(buff, nbytes);
/*
- * 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
- * the traditional Postgres behavior that forces ASCII-style treatment
- * of I/i, but in non-default collations you get exactly what the
- * collation says.
+ * 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 the traditional Postgres behavior that
+ * forces ASCII-style treatment of I/i, but in non-default
+ * collations you get exactly what the collation says.
*/
for (p = result; *p; p++)
{