diff options
Diffstat (limited to 'src/backend/utils/adt')
-rw-r--r-- | src/backend/utils/adt/formatting.c | 13 | ||||
-rw-r--r-- | src/backend/utils/adt/like_match.c | 12 | ||||
-rw-r--r-- | src/backend/utils/adt/oid.c | 10 | ||||
-rw-r--r-- | src/backend/utils/adt/pg_locale.c | 65 | ||||
-rw-r--r-- | src/backend/utils/adt/xml.c | 10 |
5 files changed, 58 insertions, 52 deletions
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index e83a1d90141..08ddab214d3 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -1,7 +1,7 @@ /* ----------------------------------------------------------------------- * formatting.c * - * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.170 2010/04/07 21:41:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.171 2010/07/06 19:18:58 momjian Exp $ * * * Portions Copyright (c) 1999-2010, PostgreSQL Global Development Group @@ -2658,12 +2658,13 @@ DCH_from_char(FormatNode *node, char *in, TmFromChar *out) s += SKIP_THth(n->suffix); break; case DCH_Q: + /* - * We ignore 'Q' when converting to date because it is - * unclear which date in the quarter to use, and some - * people specify both quarter and month, so if it was - * honored it might conflict with the supplied month. - * That is also why we don't throw an error. + * We ignore 'Q' when converting to date because it is unclear + * which date in the quarter to use, and some people specify + * both quarter and month, so if it was honored it might + * conflict with the supplied month. That is also why we don't + * throw an error. * * We still parse the source string for an integer, but it * isn't stored anywhere in 'out'. diff --git a/src/backend/utils/adt/like_match.c b/src/backend/utils/adt/like_match.c index be3b9515dfe..4f762b85c33 100644 --- a/src/backend/utils/adt/like_match.c +++ b/src/backend/utils/adt/like_match.c @@ -19,7 +19,7 @@ * Copyright (c) 1996-2010, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.29 2010/05/28 18:18:19 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/like_match.c,v 1.30 2010/07/06 19:18:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -116,10 +116,10 @@ MatchText(char *t, int tlen, char *p, int plen) * If there are wildcards immediately following the %, we can skip * over them first, using the idea that any sequence of N _'s and * one or more %'s is equivalent to N _'s and one % (ie, it will - * match any sequence of at least N text characters). In this - * way we will always run the recursive search loop using a - * pattern fragment that begins with a literal character-to-match, - * thereby not recursing more than we have to. + * match any sequence of at least N text characters). In this way + * we will always run the recursive search loop using a pattern + * fragment that begins with a literal character-to-match, thereby + * not recursing more than we have to. */ NextByte(p, plen); @@ -173,7 +173,7 @@ MatchText(char *t, int tlen, char *p, int plen) int matched = MatchText(t, tlen, p, plen); if (matched != LIKE_FALSE) - return matched; /* TRUE or ABORT */ + return matched; /* TRUE or ABORT */ } NextChar(t, tlen); diff --git a/src/backend/utils/adt/oid.c b/src/backend/utils/adt/oid.c index ba86625e271..e2371781222 100644 --- a/src/backend/utils/adt/oid.c +++ b/src/backend/utils/adt/oid.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.77 2010/06/13 17:43:13 rhaas Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/oid.c,v 1.78 2010/07/06 19:18:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -314,15 +314,17 @@ oidparse(Node *node) case T_Integer: return intVal(node); case T_Float: + /* - * Values too large for int4 will be represented as Float constants - * by the lexer. Accept these if they are valid OID strings. + * Values too large for int4 will be represented as Float + * constants by the lexer. Accept these if they are valid OID + * strings. */ return oidin_subr(strVal(node), NULL); default: elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node)); } - return InvalidOid; /* keep compiler quiet */ + return InvalidOid; /* keep compiler quiet */ } diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c index 5b4d1736c76..2006d022fa5 100644 --- a/src/backend/utils/adt/pg_locale.c +++ b/src/backend/utils/adt/pg_locale.c @@ -4,7 +4,7 @@ * * Portions Copyright (c) 2002-2010, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.56 2010/04/26 14:17:52 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/pg_locale.c,v 1.57 2010/07/06 19:18:58 momjian Exp $ * *----------------------------------------------------------------------- */ @@ -44,7 +44,7 @@ * * FYI, The Open Group locale standard is defined here: * - * http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html + * http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap07.html *---------- */ @@ -398,13 +398,13 @@ free_struct_lconv(struct lconv * s) static char * db_encoding_strdup(int encoding, const char *str) { - char *pstr; - char *mstr; + char *pstr; + char *mstr; /* convert the string to the database encoding */ pstr = (char *) pg_do_encoding_conversion( - (unsigned char *) str, strlen(str), - encoding, GetDatabaseEncoding()); + (unsigned char *) str, strlen(str), + encoding, GetDatabaseEncoding()); mstr = strdup(pstr); if (pstr != str) pfree(pstr); @@ -428,6 +428,7 @@ PGLC_localeconv(void) char *grouping; char *thousands_sep; int encoding; + #ifdef WIN32 char *save_lc_ctype; #endif @@ -448,27 +449,27 @@ PGLC_localeconv(void) save_lc_numeric = pstrdup(save_lc_numeric); #ifdef WIN32 - /* - * Ideally, monetary and numeric local symbols could be returned in - * any server encoding. Unfortunately, the WIN32 API does not allow - * setlocale() to return values in a codepage/CTYPE that uses more - * than two bytes per character, like UTF-8: - * - * http://msdn.microsoft.com/en-us/library/x99tb11d.aspx - * - * Evidently, LC_CTYPE allows us to control the encoding used - * for strings returned by localeconv(). The Open Group - * standard, mentioned at the top of this C file, doesn't - * explicitly state this. - * - * Therefore, we set LC_CTYPE to match LC_NUMERIC or LC_MONETARY - * (which cannot be UTF8), call localeconv(), and then convert from - * the numeric/monitary LC_CTYPE to the server encoding. One - * example use of this is for the Euro symbol. - * - * Perhaps someday we will use GetLocaleInfoW() which returns values - * in UTF16 and convert from that. - */ + + /* + * Ideally, monetary and numeric local symbols could be returned in any + * server encoding. Unfortunately, the WIN32 API does not allow + * setlocale() to return values in a codepage/CTYPE that uses more than + * two bytes per character, like UTF-8: + * + * http://msdn.microsoft.com/en-us/library/x99tb11d.aspx + * + * Evidently, LC_CTYPE allows us to control the encoding used for strings + * returned by localeconv(). The Open Group standard, mentioned at the + * top of this C file, doesn't explicitly state this. + * + * Therefore, we set LC_CTYPE to match LC_NUMERIC or LC_MONETARY (which + * cannot be UTF8), call localeconv(), and then convert from the + * numeric/monitary LC_CTYPE to the server encoding. One example use of + * this is for the Euro symbol. + * + * Perhaps someday we will use GetLocaleInfoW() which returns values in + * UTF16 and convert from that. + */ /* save user's value of ctype locale */ save_lc_ctype = setlocale(LC_CTYPE, NULL); @@ -567,6 +568,7 @@ strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm len = wcsftime(wbuf, MAX_L10N_DATA, format, tm); if (len == 0) + /* * strftime call failed - return 0 with the contents of dst * unspecified @@ -595,7 +597,6 @@ strftime_win32(char *dst, size_t dstlen, const wchar_t *format, const struct tm /* redefine strftime() */ #define strftime(a,b,c,d) strftime_win32(a,b,L##c,d) - #endif /* WIN32 */ @@ -611,6 +612,7 @@ cache_locale_time(void) char buf[MAX_L10N_DATA]; char *ptr; int i; + #ifdef WIN32 char *save_lc_ctype; #endif @@ -627,13 +629,14 @@ cache_locale_time(void) save_lc_time = pstrdup(save_lc_time); #ifdef WIN32 + /* * On WIN32, there is no way to get locale-specific time values in a * specified locale, like we do for monetary/numeric. We can only get * CP_ACP (see strftime_win32) or UTF16. Therefore, we get UTF16 and - * convert it to the database locale. However, wcsftime() internally - * uses LC_CTYPE, so we set it here. See the WIN32 comment near the - * top of PGLC_localeconv(). + * convert it to the database locale. However, wcsftime() internally uses + * LC_CTYPE, so we set it here. See the WIN32 comment near the top of + * PGLC_localeconv(). */ /* save user's value of ctype locale */ diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 3719e3715e7..eaf5b4d5502 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.97 2010/03/03 17:29:45 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.98 2010/07/06 19:18:58 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -846,7 +846,7 @@ xml_is_document(xmltype *arg) * pg_xml_init --- set up for use of libxml * * This should be called by each function that is about to use libxml - * facilities. It has two responsibilities: verify compatibility with the + * facilities. It has two responsibilities: verify compatibility with the * loaded libxml version (done on first call in a session) and establish * or re-establish our libxml error handler. The latter needs to be done * anytime we might have passed control to add-on modules (eg libperl) which @@ -1121,7 +1121,7 @@ static bool print_xml_decl(StringInfo buf, const xmlChar *version, pg_enc encoding, int standalone) { - pg_xml_init(); /* why is this here? */ + pg_xml_init(); /* why is this here? */ if ((version && strcmp((char *) version, PG_XML_DEFAULT_VERSION) != 0) || (encoding && encoding != PG_UTF8) @@ -1338,8 +1338,8 @@ xml_ereport(int level, int sqlcode, const char *msg) /* * It might seem that we should just pass xml_err_buf->data directly to * errdetail. However, we want to clean out xml_err_buf before throwing - * error, in case there is another function using libxml further down - * the call stack. + * error, in case there is another function using libxml further down the + * call stack. */ if (xml_err_buf->len > 0) { |