|
27 | 27 | #include "commands/comment.h"
|
28 | 28 | #include "commands/dbcommands.h"
|
29 | 29 | #include "commands/defrem.h"
|
| 30 | +#include "common/string.h" |
30 | 31 | #include "mb/pg_wchar.h"
|
31 | 32 | #include "miscadmin.h"
|
32 | 33 | #include "utils/acl.h"
|
@@ -286,23 +287,6 @@ pg_collation_actual_version(PG_FUNCTION_ARGS)
|
286 | 287 | #define READ_LOCALE_A_OUTPUT
|
287 | 288 | #endif
|
288 | 289 |
|
289 |
| -#if defined(READ_LOCALE_A_OUTPUT) || defined(USE_ICU) |
290 |
| -/* |
291 |
| - * Check a string to see if it is pure ASCII |
292 |
| - */ |
293 |
| -static bool |
294 |
| -is_all_ascii(const char *str) |
295 |
| -{ |
296 |
| - while (*str) |
297 |
| - { |
298 |
| - if (IS_HIGHBIT_SET(*str)) |
299 |
| - return false; |
300 |
| - str++; |
301 |
| - } |
302 |
| - return true; |
303 |
| -} |
304 |
| -#endif /* READ_LOCALE_A_OUTPUT || USE_ICU */ |
305 |
| - |
306 | 290 | #ifdef READ_LOCALE_A_OUTPUT
|
307 | 291 | /*
|
308 | 292 | * "Normalize" a libc locale name, stripping off encoding tags such as
|
@@ -396,7 +380,7 @@ get_icu_locale_comment(const char *localename)
|
396 | 380 | if (U_FAILURE(status))
|
397 | 381 | return NULL; /* no good reason to raise an error */
|
398 | 382 |
|
399 |
| - /* Check for non-ASCII comment (can't use is_all_ascii for this) */ |
| 383 | + /* Check for non-ASCII comment (can't use pg_is_ascii for this) */ |
400 | 384 | for (i = 0; i < len_uchar; i++)
|
401 | 385 | {
|
402 | 386 | if (displayname[i] > 127)
|
@@ -477,7 +461,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
|
477 | 461 | * interpret the non-ASCII characters. We can't do much with
|
478 | 462 | * those, so we filter them out.
|
479 | 463 | */
|
480 |
| - if (!is_all_ascii(localebuf)) |
| 464 | + if (!pg_is_ascii(localebuf)) |
481 | 465 | {
|
482 | 466 | elog(DEBUG1, "locale name has non-ASCII characters, skipped: \"%s\"", localebuf);
|
483 | 467 | continue;
|
@@ -623,7 +607,7 @@ pg_import_system_collations(PG_FUNCTION_ARGS)
|
623 | 607 | * Be paranoid about not allowing any non-ASCII strings into
|
624 | 608 | * pg_collation
|
625 | 609 | */
|
626 |
| - if (!is_all_ascii(langtag) || !is_all_ascii(collcollate)) |
| 610 | + if (!pg_is_ascii(langtag) || !pg_is_ascii(collcollate)) |
627 | 611 | continue;
|
628 | 612 |
|
629 | 613 | collid = CollationCreate(psprintf("%s-x-icu", langtag),
|
|
0 commit comments