Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit692221f

Browse files
michaelpqpull[bot]
authored andcommitted
Rename enum labels of PG_Locale_Strategy
PG_REGEX_BUILTIN was added inf69319f but it did not follow thesame pattern as the previous labels, i.e. PG_LOCALE_*. In addition tothis, the two libc strategies did not include in the name that they wererelated to this library.The enum labels are renamed as PG_STRATEGY_type[_subtype] to make thecode clearer, in accordance to the library and the functions they relyon.Author: Andreas KarlssonDiscussion:https://postgr.es/m/6f81200f-68fd-411e-97a1-d1f291d2e222@proxel.se
1 parent4fb3cdd commit692221f

File tree

1 file changed

+70
-70
lines changed

1 file changed

+70
-70
lines changed

‎src/backend/regex/regc_pg_locale.c

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@
6565

6666
typedefenum
6767
{
68-
PG_REGEX_LOCALE_C,/* C locale (encoding independent) */
69-
PG_REGEX_BUILTIN,/* built-in Unicode semantics */
70-
PG_REGEX_LOCALE_WIDE_L,/* Use locale_t <wctype.h> functions */
71-
PG_REGEX_LOCALE_1BYTE_L,/* Use locale_t <ctype.h> functions */
72-
PG_REGEX_LOCALE_ICU,/* Use ICU uchar.h functions */
68+
PG_REGEX_STRATEGY_C,/* C locale (encoding independent) */
69+
PG_REGEX_STRATEGY_BUILTIN,/* built-in Unicode semantics */
70+
PG_REGEX_STRATEGY_LIBC_WIDE,/* Use locale_t <wctype.h> functions */
71+
PG_REGEX_STRATEGY_LIBC_1BYTE,/* Use locale_t <ctype.h> functions */
72+
PG_REGEX_STRATEGY_ICU,/* Use ICU uchar.h functions */
7373
}PG_Locale_Strategy;
7474

7575
staticPG_Locale_Strategypg_regex_strategy;
@@ -246,7 +246,7 @@ pg_set_regex_collation(Oid collation)
246246
if (lc_ctype_is_c(collation))
247247
{
248248
/* C/POSIX collations use this path regardless of database encoding */
249-
pg_regex_strategy=PG_REGEX_LOCALE_C;
249+
pg_regex_strategy=PG_REGEX_STRATEGY_C;
250250
pg_regex_locale=0;
251251
pg_regex_collation=C_COLLATION_OID;
252252
}
@@ -262,20 +262,20 @@ pg_set_regex_collation(Oid collation)
262262
if (pg_regex_locale->provider==COLLPROVIDER_BUILTIN)
263263
{
264264
Assert(GetDatabaseEncoding()==PG_UTF8);
265-
pg_regex_strategy=PG_REGEX_BUILTIN;
265+
pg_regex_strategy=PG_REGEX_STRATEGY_BUILTIN;
266266
}
267267
#ifdefUSE_ICU
268268
elseif (pg_regex_locale->provider==COLLPROVIDER_ICU)
269269
{
270-
pg_regex_strategy=PG_REGEX_LOCALE_ICU;
270+
pg_regex_strategy=PG_REGEX_STRATEGY_ICU;
271271
}
272272
#endif
273273
else
274274
{
275275
if (GetDatabaseEncoding()==PG_UTF8)
276-
pg_regex_strategy=PG_REGEX_LOCALE_WIDE_L;
276+
pg_regex_strategy=PG_REGEX_STRATEGY_LIBC_WIDE;
277277
else
278-
pg_regex_strategy=PG_REGEX_LOCALE_1BYTE_L;
278+
pg_regex_strategy=PG_REGEX_STRATEGY_LIBC_1BYTE;
279279
}
280280

281281
pg_regex_collation=collation;
@@ -287,20 +287,20 @@ pg_wc_isdigit(pg_wchar c)
287287
{
288288
switch (pg_regex_strategy)
289289
{
290-
casePG_REGEX_LOCALE_C:
290+
casePG_REGEX_STRATEGY_C:
291291
return (c <= (pg_wchar)127&&
292292
(pg_char_properties[c]&PG_ISDIGIT));
293-
casePG_REGEX_BUILTIN:
293+
casePG_REGEX_STRATEGY_BUILTIN:
294294
returnpg_u_isdigit(c, true);
295-
casePG_REGEX_LOCALE_WIDE_L:
295+
casePG_REGEX_STRATEGY_LIBC_WIDE:
296296
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
297297
returniswdigit_l((wint_t)c,pg_regex_locale->info.lt);
298298
/* FALL THRU */
299-
casePG_REGEX_LOCALE_1BYTE_L:
299+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
300300
return (c <= (pg_wchar)UCHAR_MAX&&
301301
isdigit_l((unsignedchar)c,pg_regex_locale->info.lt));
302302
break;
303-
casePG_REGEX_LOCALE_ICU:
303+
casePG_REGEX_STRATEGY_ICU:
304304
#ifdefUSE_ICU
305305
returnu_isdigit(c);
306306
#endif
@@ -314,20 +314,20 @@ pg_wc_isalpha(pg_wchar c)
314314
{
315315
switch (pg_regex_strategy)
316316
{
317-
casePG_REGEX_LOCALE_C:
317+
casePG_REGEX_STRATEGY_C:
318318
return (c <= (pg_wchar)127&&
319319
(pg_char_properties[c]&PG_ISALPHA));
320-
casePG_REGEX_BUILTIN:
320+
casePG_REGEX_STRATEGY_BUILTIN:
321321
returnpg_u_isalpha(c);
322-
casePG_REGEX_LOCALE_WIDE_L:
322+
casePG_REGEX_STRATEGY_LIBC_WIDE:
323323
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
324324
returniswalpha_l((wint_t)c,pg_regex_locale->info.lt);
325325
/* FALL THRU */
326-
casePG_REGEX_LOCALE_1BYTE_L:
326+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
327327
return (c <= (pg_wchar)UCHAR_MAX&&
328328
isalpha_l((unsignedchar)c,pg_regex_locale->info.lt));
329329
break;
330-
casePG_REGEX_LOCALE_ICU:
330+
casePG_REGEX_STRATEGY_ICU:
331331
#ifdefUSE_ICU
332332
returnu_isalpha(c);
333333
#endif
@@ -341,20 +341,20 @@ pg_wc_isalnum(pg_wchar c)
341341
{
342342
switch (pg_regex_strategy)
343343
{
344-
casePG_REGEX_LOCALE_C:
344+
casePG_REGEX_STRATEGY_C:
345345
return (c <= (pg_wchar)127&&
346346
(pg_char_properties[c]&PG_ISALNUM));
347-
casePG_REGEX_BUILTIN:
347+
casePG_REGEX_STRATEGY_BUILTIN:
348348
returnpg_u_isalnum(c, true);
349-
casePG_REGEX_LOCALE_WIDE_L:
349+
casePG_REGEX_STRATEGY_LIBC_WIDE:
350350
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
351351
returniswalnum_l((wint_t)c,pg_regex_locale->info.lt);
352352
/* FALL THRU */
353-
casePG_REGEX_LOCALE_1BYTE_L:
353+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
354354
return (c <= (pg_wchar)UCHAR_MAX&&
355355
isalnum_l((unsignedchar)c,pg_regex_locale->info.lt));
356356
break;
357-
casePG_REGEX_LOCALE_ICU:
357+
casePG_REGEX_STRATEGY_ICU:
358358
#ifdefUSE_ICU
359359
returnu_isalnum(c);
360360
#endif
@@ -377,20 +377,20 @@ pg_wc_isupper(pg_wchar c)
377377
{
378378
switch (pg_regex_strategy)
379379
{
380-
casePG_REGEX_LOCALE_C:
380+
casePG_REGEX_STRATEGY_C:
381381
return (c <= (pg_wchar)127&&
382382
(pg_char_properties[c]&PG_ISUPPER));
383-
casePG_REGEX_BUILTIN:
383+
casePG_REGEX_STRATEGY_BUILTIN:
384384
returnpg_u_isupper(c);
385-
casePG_REGEX_LOCALE_WIDE_L:
385+
casePG_REGEX_STRATEGY_LIBC_WIDE:
386386
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
387387
returniswupper_l((wint_t)c,pg_regex_locale->info.lt);
388388
/* FALL THRU */
389-
casePG_REGEX_LOCALE_1BYTE_L:
389+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
390390
return (c <= (pg_wchar)UCHAR_MAX&&
391391
isupper_l((unsignedchar)c,pg_regex_locale->info.lt));
392392
break;
393-
casePG_REGEX_LOCALE_ICU:
393+
casePG_REGEX_STRATEGY_ICU:
394394
#ifdefUSE_ICU
395395
returnu_isupper(c);
396396
#endif
@@ -404,20 +404,20 @@ pg_wc_islower(pg_wchar c)
404404
{
405405
switch (pg_regex_strategy)
406406
{
407-
casePG_REGEX_LOCALE_C:
407+
casePG_REGEX_STRATEGY_C:
408408
return (c <= (pg_wchar)127&&
409409
(pg_char_properties[c]&PG_ISLOWER));
410-
casePG_REGEX_BUILTIN:
410+
casePG_REGEX_STRATEGY_BUILTIN:
411411
returnpg_u_islower(c);
412-
casePG_REGEX_LOCALE_WIDE_L:
412+
casePG_REGEX_STRATEGY_LIBC_WIDE:
413413
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
414414
returniswlower_l((wint_t)c,pg_regex_locale->info.lt);
415415
/* FALL THRU */
416-
casePG_REGEX_LOCALE_1BYTE_L:
416+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
417417
return (c <= (pg_wchar)UCHAR_MAX&&
418418
islower_l((unsignedchar)c,pg_regex_locale->info.lt));
419419
break;
420-
casePG_REGEX_LOCALE_ICU:
420+
casePG_REGEX_STRATEGY_ICU:
421421
#ifdefUSE_ICU
422422
returnu_islower(c);
423423
#endif
@@ -431,20 +431,20 @@ pg_wc_isgraph(pg_wchar c)
431431
{
432432
switch (pg_regex_strategy)
433433
{
434-
casePG_REGEX_LOCALE_C:
434+
casePG_REGEX_STRATEGY_C:
435435
return (c <= (pg_wchar)127&&
436436
(pg_char_properties[c]&PG_ISGRAPH));
437-
casePG_REGEX_BUILTIN:
437+
casePG_REGEX_STRATEGY_BUILTIN:
438438
returnpg_u_isgraph(c);
439-
casePG_REGEX_LOCALE_WIDE_L:
439+
casePG_REGEX_STRATEGY_LIBC_WIDE:
440440
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
441441
returniswgraph_l((wint_t)c,pg_regex_locale->info.lt);
442442
/* FALL THRU */
443-
casePG_REGEX_LOCALE_1BYTE_L:
443+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
444444
return (c <= (pg_wchar)UCHAR_MAX&&
445445
isgraph_l((unsignedchar)c,pg_regex_locale->info.lt));
446446
break;
447-
casePG_REGEX_LOCALE_ICU:
447+
casePG_REGEX_STRATEGY_ICU:
448448
#ifdefUSE_ICU
449449
returnu_isgraph(c);
450450
#endif
@@ -458,20 +458,20 @@ pg_wc_isprint(pg_wchar c)
458458
{
459459
switch (pg_regex_strategy)
460460
{
461-
casePG_REGEX_LOCALE_C:
461+
casePG_REGEX_STRATEGY_C:
462462
return (c <= (pg_wchar)127&&
463463
(pg_char_properties[c]&PG_ISPRINT));
464-
casePG_REGEX_BUILTIN:
464+
casePG_REGEX_STRATEGY_BUILTIN:
465465
returnpg_u_isprint(c);
466-
casePG_REGEX_LOCALE_WIDE_L:
466+
casePG_REGEX_STRATEGY_LIBC_WIDE:
467467
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
468468
returniswprint_l((wint_t)c,pg_regex_locale->info.lt);
469469
/* FALL THRU */
470-
casePG_REGEX_LOCALE_1BYTE_L:
470+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
471471
return (c <= (pg_wchar)UCHAR_MAX&&
472472
isprint_l((unsignedchar)c,pg_regex_locale->info.lt));
473473
break;
474-
casePG_REGEX_LOCALE_ICU:
474+
casePG_REGEX_STRATEGY_ICU:
475475
#ifdefUSE_ICU
476476
returnu_isprint(c);
477477
#endif
@@ -485,20 +485,20 @@ pg_wc_ispunct(pg_wchar c)
485485
{
486486
switch (pg_regex_strategy)
487487
{
488-
casePG_REGEX_LOCALE_C:
488+
casePG_REGEX_STRATEGY_C:
489489
return (c <= (pg_wchar)127&&
490490
(pg_char_properties[c]&PG_ISPUNCT));
491-
casePG_REGEX_BUILTIN:
491+
casePG_REGEX_STRATEGY_BUILTIN:
492492
returnpg_u_ispunct(c, true);
493-
casePG_REGEX_LOCALE_WIDE_L:
493+
casePG_REGEX_STRATEGY_LIBC_WIDE:
494494
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
495495
returniswpunct_l((wint_t)c,pg_regex_locale->info.lt);
496496
/* FALL THRU */
497-
casePG_REGEX_LOCALE_1BYTE_L:
497+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
498498
return (c <= (pg_wchar)UCHAR_MAX&&
499499
ispunct_l((unsignedchar)c,pg_regex_locale->info.lt));
500500
break;
501-
casePG_REGEX_LOCALE_ICU:
501+
casePG_REGEX_STRATEGY_ICU:
502502
#ifdefUSE_ICU
503503
returnu_ispunct(c);
504504
#endif
@@ -512,20 +512,20 @@ pg_wc_isspace(pg_wchar c)
512512
{
513513
switch (pg_regex_strategy)
514514
{
515-
casePG_REGEX_LOCALE_C:
515+
casePG_REGEX_STRATEGY_C:
516516
return (c <= (pg_wchar)127&&
517517
(pg_char_properties[c]&PG_ISSPACE));
518-
casePG_REGEX_BUILTIN:
518+
casePG_REGEX_STRATEGY_BUILTIN:
519519
returnpg_u_isspace(c);
520-
casePG_REGEX_LOCALE_WIDE_L:
520+
casePG_REGEX_STRATEGY_LIBC_WIDE:
521521
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
522522
returniswspace_l((wint_t)c,pg_regex_locale->info.lt);
523523
/* FALL THRU */
524-
casePG_REGEX_LOCALE_1BYTE_L:
524+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
525525
return (c <= (pg_wchar)UCHAR_MAX&&
526526
isspace_l((unsignedchar)c,pg_regex_locale->info.lt));
527527
break;
528-
casePG_REGEX_LOCALE_ICU:
528+
casePG_REGEX_STRATEGY_ICU:
529529
#ifdefUSE_ICU
530530
returnu_isspace(c);
531531
#endif
@@ -539,21 +539,21 @@ pg_wc_toupper(pg_wchar c)
539539
{
540540
switch (pg_regex_strategy)
541541
{
542-
casePG_REGEX_LOCALE_C:
542+
casePG_REGEX_STRATEGY_C:
543543
if (c <= (pg_wchar)127)
544544
returnpg_ascii_toupper((unsignedchar)c);
545545
returnc;
546-
casePG_REGEX_BUILTIN:
546+
casePG_REGEX_STRATEGY_BUILTIN:
547547
returnunicode_uppercase_simple(c);
548-
casePG_REGEX_LOCALE_WIDE_L:
548+
casePG_REGEX_STRATEGY_LIBC_WIDE:
549549
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
550550
returntowupper_l((wint_t)c,pg_regex_locale->info.lt);
551551
/* FALL THRU */
552-
casePG_REGEX_LOCALE_1BYTE_L:
552+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
553553
if (c <= (pg_wchar)UCHAR_MAX)
554554
returntoupper_l((unsignedchar)c,pg_regex_locale->info.lt);
555555
returnc;
556-
casePG_REGEX_LOCALE_ICU:
556+
casePG_REGEX_STRATEGY_ICU:
557557
#ifdefUSE_ICU
558558
returnu_toupper(c);
559559
#endif
@@ -567,21 +567,21 @@ pg_wc_tolower(pg_wchar c)
567567
{
568568
switch (pg_regex_strategy)
569569
{
570-
casePG_REGEX_LOCALE_C:
570+
casePG_REGEX_STRATEGY_C:
571571
if (c <= (pg_wchar)127)
572572
returnpg_ascii_tolower((unsignedchar)c);
573573
returnc;
574-
casePG_REGEX_BUILTIN:
574+
casePG_REGEX_STRATEGY_BUILTIN:
575575
returnunicode_lowercase_simple(c);
576-
casePG_REGEX_LOCALE_WIDE_L:
576+
casePG_REGEX_STRATEGY_LIBC_WIDE:
577577
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
578578
returntowlower_l((wint_t)c,pg_regex_locale->info.lt);
579579
/* FALL THRU */
580-
casePG_REGEX_LOCALE_1BYTE_L:
580+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
581581
if (c <= (pg_wchar)UCHAR_MAX)
582582
returntolower_l((unsignedchar)c,pg_regex_locale->info.lt);
583583
returnc;
584-
casePG_REGEX_LOCALE_ICU:
584+
casePG_REGEX_STRATEGY_ICU:
585585
#ifdefUSE_ICU
586586
returnu_tolower(c);
587587
#endif
@@ -715,29 +715,29 @@ pg_ctype_get_cache(pg_wc_probefunc probefunc, int cclasscode)
715715
*/
716716
switch (pg_regex_strategy)
717717
{
718-
casePG_REGEX_LOCALE_C:
718+
casePG_REGEX_STRATEGY_C:
719719
#ifMAX_SIMPLE_CHR >=127
720720
max_chr= (pg_wchar)127;
721721
pcc->cv.cclasscode=-1;
722722
#else
723723
max_chr= (pg_wchar)MAX_SIMPLE_CHR;
724724
#endif
725725
break;
726-
casePG_REGEX_BUILTIN:
726+
casePG_REGEX_STRATEGY_BUILTIN:
727727
max_chr= (pg_wchar)MAX_SIMPLE_CHR;
728728
break;
729-
casePG_REGEX_LOCALE_WIDE_L:
729+
casePG_REGEX_STRATEGY_LIBC_WIDE:
730730
max_chr= (pg_wchar)MAX_SIMPLE_CHR;
731731
break;
732-
casePG_REGEX_LOCALE_1BYTE_L:
732+
casePG_REGEX_STRATEGY_LIBC_1BYTE:
733733
#ifMAX_SIMPLE_CHR >=UCHAR_MAX
734734
max_chr= (pg_wchar)UCHAR_MAX;
735735
pcc->cv.cclasscode=-1;
736736
#else
737737
max_chr= (pg_wchar)MAX_SIMPLE_CHR;
738738
#endif
739739
break;
740-
casePG_REGEX_LOCALE_ICU:
740+
casePG_REGEX_STRATEGY_ICU:
741741
max_chr= (pg_wchar)MAX_SIMPLE_CHR;
742742
break;
743743
default:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp