1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Standard pgindent run for 8.1.

This commit is contained in:
Bruce Momjian
2005-10-15 02:49:52 +00:00
parent 790c01d280
commit 1dc3498251
770 changed files with 34334 additions and 32507 deletions

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.61 2005/08/24 17:50:00 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/adt/oracle_compat.c,v 1.62 2005/10/15 02:49:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -87,12 +87,12 @@ texttowcs(const text *txt)
if (ncodes == (size_t) -1)
{
/*
* Invalid multibyte character encountered. We try to give a
* useful error message by letting pg_verifymbstr check the
* string. But it's possible that the string is OK to us, and not
* OK to mbstowcs --- this suggests that the LC_CTYPE locale is
* different from the database encoding. Give a generic error
* message if verifymbstr can't find anything wrong.
* Invalid multibyte character encountered. We try to give a useful
* error message by letting pg_verifymbstr check the string. But it's
* possible that the string is OK to us, and not OK to mbstowcs ---
* this suggests that the LC_CTYPE locale is different from the
* database encoding. Give a generic error message if verifymbstr
* can't find anything wrong.
*/
pg_verifymbstr(workstr, nbytes, false);
ereport(ERROR,
@ -164,11 +164,11 @@ win32_utf8_texttowcs(const text *txt)
{
int nbytes = VARSIZE(txt) - VARHDRSZ;
wchar_t *result;
int r;
int r;
/* Overflow paranoia */
if (nbytes < 0 ||
nbytes > (int) (INT_MAX / sizeof(wchar_t)) -1)
nbytes > (int) (INT_MAX / sizeof(wchar_t)) - 1)
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory")));
@ -206,9 +206,9 @@ win32_utf8_texttowcs(const text *txt)
static text *
win32_utf8_wcstotext(const wchar_t *str)
{
text *result;
int nbytes;
int r;
text *result;
int nbytes;
int r;
nbytes = WideCharToMultiByte(CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL);
if (nbytes == 0) /* shouldn't happen */
@ -217,7 +217,7 @@ win32_utf8_wcstotext(const wchar_t *str)
errmsg("UTF16 to UTF8 translation failed: %lu",
GetLastError())));
result = palloc(nbytes+VARHDRSZ);
result = palloc(nbytes + VARHDRSZ);
r = WideCharToMultiByte(CP_UTF8, 0, str, -1, VARDATA(result), nbytes,
NULL, NULL);
@ -227,7 +227,7 @@ win32_utf8_wcstotext(const wchar_t *str)
errmsg("UTF16 to UTF8 translation failed: %lu",
GetLastError())));
VARATT_SIZEP(result) = nbytes + VARHDRSZ - 1; /* -1 to ignore null */
VARATT_SIZEP(result) = nbytes + VARHDRSZ - 1; /* -1 to ignore null */
return result;
}
@ -256,8 +256,7 @@ win32_wcstotext(const wchar_t *str, int ncodes)
#define texttowcs win32_texttowcs
#define wcstotext win32_wcstotext
#endif /* WIN32 */
#endif /* WIN32 */
/********************************************************************
@ -278,10 +277,11 @@ Datum
lower(PG_FUNCTION_ARGS)
{
#ifdef USE_WIDE_UPPER_LOWER
/*
* Use wide char code only when max encoding length > 1 and ctype != C.
* Some operating systems fail with multi-byte encodings and a C locale.
* Also, for a C locale there is no need to process as multibyte.
* Use wide char code only when max encoding length > 1 and ctype != C.
* Some operating systems fail with multi-byte encodings and a C locale.
* Also, for a C locale there is no need to process as multibyte.
*/
if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c())
{
@ -309,8 +309,7 @@ lower(PG_FUNCTION_ARGS)
int m;
/*
* Since we copied the string, we can scribble directly on the
* value
* Since we copied the string, we can scribble directly on the value
*/
ptr = VARDATA(string);
m = VARSIZE(string) - VARHDRSZ;
@ -344,10 +343,11 @@ Datum
upper(PG_FUNCTION_ARGS)
{
#ifdef USE_WIDE_UPPER_LOWER
/*
* Use wide char code only when max encoding length > 1 and ctype != C.
* Some operating systems fail with multi-byte encodings and a C locale.
* Also, for a C locale there is no need to process as multibyte.
* Use wide char code only when max encoding length > 1 and ctype != C.
* Some operating systems fail with multi-byte encodings and a C locale.
* Also, for a C locale there is no need to process as multibyte.
*/
if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c())
{
@ -375,8 +375,7 @@ upper(PG_FUNCTION_ARGS)
int m;
/*
* Since we copied the string, we can scribble directly on the
* value
* Since we copied the string, we can scribble directly on the value
*/
ptr = VARDATA(string);
m = VARSIZE(string) - VARHDRSZ;
@ -413,10 +412,11 @@ Datum
initcap(PG_FUNCTION_ARGS)
{
#ifdef USE_WIDE_UPPER_LOWER
/*
* Use wide char code only when max encoding length > 1 and ctype != C.
* Some operating systems fail with multi-byte encodings and a C locale.
* Also, for a C locale there is no need to process as multibyte.
* Use wide char code only when max encoding length > 1 and ctype != C.
* Some operating systems fail with multi-byte encodings and a C locale.
* Also, for a C locale there is no need to process as multibyte.
*/
if (pg_database_encoding_max_length() > 1 && !lc_ctype_is_c())
{
@ -452,8 +452,7 @@ initcap(PG_FUNCTION_ARGS)
int m;
/*
* Since we copied the string, we can scribble directly on the
* value
* Since we copied the string, we can scribble directly on the value
*/
ptr = VARDATA(string);
m = VARSIZE(string) - VARHDRSZ;
@ -732,8 +731,8 @@ dotrim(const char *string, int stringlen,
{
/*
* In the multibyte-encoding case, build arrays of pointers to
* character starts, so that we can avoid inefficient checks
* in the inner loops.
* character starts, so that we can avoid inefficient checks in
* the inner loops.
*/
const char **stringchars;
const char **setchars;
@ -828,8 +827,7 @@ dotrim(const char *string, int stringlen,
else
{
/*
* In the single-byte-encoding case, we don't need such
* overhead.
* In the single-byte-encoding case, we don't need such overhead.
*/
if (doltrim)
{
@ -1152,9 +1150,9 @@ translate(PG_FUNCTION_ARGS)
VARATT_SIZEP(result) = retlen + VARHDRSZ;
/*
* There may be some wasted space in the result if deletions occurred,
* but it's not worth reallocating it; the function result probably
* won't live long anyway.
* There may be some wasted space in the result if deletions occurred, but
* it's not worth reallocating it; the function result probably won't live
* long anyway.
*/
PG_RETURN_TEXT_P(result);