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

Commit85feb77

Browse files
committed
Assume wcstombs(), towlower(), and sibling functions are always present.
These functions are required by SUS v2, which is our minimum baselinefor Unix platforms, and are present on all interesting Windows versionsas well. Even our oldest buildfarm members have them. Thus, we were nottesting the "!USE_WIDE_UPPER_LOWER" code paths, which explains why the bugfixed in commite6023ee escaped detection. Per discussion, there seemsto be no more real-world value in maintaining this option. Hence, removethe configure-time tests for wcstombs() and towlower(), remove theUSE_WIDE_UPPER_LOWER symbol, and remove all the !USE_WIDE_UPPER_LOWER code.There's not actually all that much of the latter, but simplifying the #ifnests is a win in itself.Discussion:https://postgr.es/m/20170921052928.GA188913@rfd.leadboat.com
1 parente6023ee commit85feb77

File tree

13 files changed

+18
-139
lines changed

13 files changed

+18
-139
lines changed

‎configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12970,7 +12970,7 @@ fi
1297012970
LIBS_including_readline="$LIBS"
1297112971
LIBS=`echo"$LIBS"| sed -e's/-ledit//g' -e's/-lreadline//g'`
1297212972

12973-
forac_funcin cbrt clock_gettime dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat pthread_is_threaded_np readlink setproctitle setsid shm_open symlink sync_file_rangetowlowerutime utimes wcstombs wcstombs_l
12973+
forac_funcin cbrt clock_gettime dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat pthread_is_threaded_np readlink setproctitle setsid shm_open symlink sync_file_range utime utimes wcstombs_l
1297412974
do:
1297512975
as_ac_var=`$as_echo"ac_cv_func_$ac_func"|$as_tr_sh`
1297612976
ac_fn_c_check_func"$LINENO""$ac_func""$as_ac_var"

‎configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ PGAC_FUNC_WCSTOMBS_L
13991399
LIBS_including_readline="$LIBS"
14001400
LIBS=`echo "$LIBS" | sed -e 's/-ledit//g' -e 's/-lreadline//g'`
14011401

1402-
AC_CHECK_FUNCS([cbrt clock_gettime dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat pthread_is_threaded_np readlink setproctitle setsid shm_open symlink sync_file_rangetowlowerutime utimes wcstombs wcstombs_l])
1402+
AC_CHECK_FUNCS([cbrt clock_gettime dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat pthread_is_threaded_np readlink setproctitle setsid shm_open symlink sync_file_range utime utimes wcstombs_l])
14031403

14041404
AC_REPLACE_FUNCS(fseeko)
14051405
case $host_os in

‎src/backend/regex/regc_pg_locale.c

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,6 @@ pg_set_regex_collation(Oid collation)
268268
pg_regex_strategy=PG_REGEX_LOCALE_ICU;
269269
else
270270
#endif
271-
#ifdefUSE_WIDE_UPPER_LOWER
272271
if (GetDatabaseEncoding()==PG_UTF8)
273272
{
274273
if (pg_regex_locale)
@@ -277,7 +276,6 @@ pg_set_regex_collation(Oid collation)
277276
pg_regex_strategy=PG_REGEX_LOCALE_WIDE;
278277
}
279278
else
280-
#endif/* USE_WIDE_UPPER_LOWER */
281279
{
282280
if (pg_regex_locale)
283281
pg_regex_strategy=PG_REGEX_LOCALE_1BYTE_L;
@@ -298,16 +296,14 @@ pg_wc_isdigit(pg_wchar c)
298296
return (c <= (pg_wchar)127&&
299297
(pg_char_properties[c]&PG_ISDIGIT));
300298
casePG_REGEX_LOCALE_WIDE:
301-
#ifdefUSE_WIDE_UPPER_LOWER
302299
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
303300
returniswdigit((wint_t)c);
304-
#endif
305301
/* FALL THRU */
306302
casePG_REGEX_LOCALE_1BYTE:
307303
return (c <= (pg_wchar)UCHAR_MAX&&
308304
isdigit((unsignedchar)c));
309305
casePG_REGEX_LOCALE_WIDE_L:
310-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
306+
#ifdefHAVE_LOCALE_T
311307
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
312308
returniswdigit_l((wint_t)c,pg_regex_locale->info.lt);
313309
#endif
@@ -336,16 +332,14 @@ pg_wc_isalpha(pg_wchar c)
336332
return (c <= (pg_wchar)127&&
337333
(pg_char_properties[c]&PG_ISALPHA));
338334
casePG_REGEX_LOCALE_WIDE:
339-
#ifdefUSE_WIDE_UPPER_LOWER
340335
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
341336
returniswalpha((wint_t)c);
342-
#endif
343337
/* FALL THRU */
344338
casePG_REGEX_LOCALE_1BYTE:
345339
return (c <= (pg_wchar)UCHAR_MAX&&
346340
isalpha((unsignedchar)c));
347341
casePG_REGEX_LOCALE_WIDE_L:
348-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
342+
#ifdefHAVE_LOCALE_T
349343
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
350344
returniswalpha_l((wint_t)c,pg_regex_locale->info.lt);
351345
#endif
@@ -374,16 +368,14 @@ pg_wc_isalnum(pg_wchar c)
374368
return (c <= (pg_wchar)127&&
375369
(pg_char_properties[c]&PG_ISALNUM));
376370
casePG_REGEX_LOCALE_WIDE:
377-
#ifdefUSE_WIDE_UPPER_LOWER
378371
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
379372
returniswalnum((wint_t)c);
380-
#endif
381373
/* FALL THRU */
382374
casePG_REGEX_LOCALE_1BYTE:
383375
return (c <= (pg_wchar)UCHAR_MAX&&
384376
isalnum((unsignedchar)c));
385377
casePG_REGEX_LOCALE_WIDE_L:
386-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
378+
#ifdefHAVE_LOCALE_T
387379
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
388380
returniswalnum_l((wint_t)c,pg_regex_locale->info.lt);
389381
#endif
@@ -412,16 +404,14 @@ pg_wc_isupper(pg_wchar c)
412404
return (c <= (pg_wchar)127&&
413405
(pg_char_properties[c]&PG_ISUPPER));
414406
casePG_REGEX_LOCALE_WIDE:
415-
#ifdefUSE_WIDE_UPPER_LOWER
416407
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
417408
returniswupper((wint_t)c);
418-
#endif
419409
/* FALL THRU */
420410
casePG_REGEX_LOCALE_1BYTE:
421411
return (c <= (pg_wchar)UCHAR_MAX&&
422412
isupper((unsignedchar)c));
423413
casePG_REGEX_LOCALE_WIDE_L:
424-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
414+
#ifdefHAVE_LOCALE_T
425415
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
426416
returniswupper_l((wint_t)c,pg_regex_locale->info.lt);
427417
#endif
@@ -450,16 +440,14 @@ pg_wc_islower(pg_wchar c)
450440
return (c <= (pg_wchar)127&&
451441
(pg_char_properties[c]&PG_ISLOWER));
452442
casePG_REGEX_LOCALE_WIDE:
453-
#ifdefUSE_WIDE_UPPER_LOWER
454443
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
455444
returniswlower((wint_t)c);
456-
#endif
457445
/* FALL THRU */
458446
casePG_REGEX_LOCALE_1BYTE:
459447
return (c <= (pg_wchar)UCHAR_MAX&&
460448
islower((unsignedchar)c));
461449
casePG_REGEX_LOCALE_WIDE_L:
462-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
450+
#ifdefHAVE_LOCALE_T
463451
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
464452
returniswlower_l((wint_t)c,pg_regex_locale->info.lt);
465453
#endif
@@ -488,16 +476,14 @@ pg_wc_isgraph(pg_wchar c)
488476
return (c <= (pg_wchar)127&&
489477
(pg_char_properties[c]&PG_ISGRAPH));
490478
casePG_REGEX_LOCALE_WIDE:
491-
#ifdefUSE_WIDE_UPPER_LOWER
492479
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
493480
returniswgraph((wint_t)c);
494-
#endif
495481
/* FALL THRU */
496482
casePG_REGEX_LOCALE_1BYTE:
497483
return (c <= (pg_wchar)UCHAR_MAX&&
498484
isgraph((unsignedchar)c));
499485
casePG_REGEX_LOCALE_WIDE_L:
500-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
486+
#ifdefHAVE_LOCALE_T
501487
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
502488
returniswgraph_l((wint_t)c,pg_regex_locale->info.lt);
503489
#endif
@@ -526,16 +512,14 @@ pg_wc_isprint(pg_wchar c)
526512
return (c <= (pg_wchar)127&&
527513
(pg_char_properties[c]&PG_ISPRINT));
528514
casePG_REGEX_LOCALE_WIDE:
529-
#ifdefUSE_WIDE_UPPER_LOWER
530515
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
531516
returniswprint((wint_t)c);
532-
#endif
533517
/* FALL THRU */
534518
casePG_REGEX_LOCALE_1BYTE:
535519
return (c <= (pg_wchar)UCHAR_MAX&&
536520
isprint((unsignedchar)c));
537521
casePG_REGEX_LOCALE_WIDE_L:
538-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
522+
#ifdefHAVE_LOCALE_T
539523
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
540524
returniswprint_l((wint_t)c,pg_regex_locale->info.lt);
541525
#endif
@@ -564,16 +548,14 @@ pg_wc_ispunct(pg_wchar c)
564548
return (c <= (pg_wchar)127&&
565549
(pg_char_properties[c]&PG_ISPUNCT));
566550
casePG_REGEX_LOCALE_WIDE:
567-
#ifdefUSE_WIDE_UPPER_LOWER
568551
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
569552
returniswpunct((wint_t)c);
570-
#endif
571553
/* FALL THRU */
572554
casePG_REGEX_LOCALE_1BYTE:
573555
return (c <= (pg_wchar)UCHAR_MAX&&
574556
ispunct((unsignedchar)c));
575557
casePG_REGEX_LOCALE_WIDE_L:
576-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
558+
#ifdefHAVE_LOCALE_T
577559
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
578560
returniswpunct_l((wint_t)c,pg_regex_locale->info.lt);
579561
#endif
@@ -602,16 +584,14 @@ pg_wc_isspace(pg_wchar c)
602584
return (c <= (pg_wchar)127&&
603585
(pg_char_properties[c]&PG_ISSPACE));
604586
casePG_REGEX_LOCALE_WIDE:
605-
#ifdefUSE_WIDE_UPPER_LOWER
606587
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
607588
returniswspace((wint_t)c);
608-
#endif
609589
/* FALL THRU */
610590
casePG_REGEX_LOCALE_1BYTE:
611591
return (c <= (pg_wchar)UCHAR_MAX&&
612592
isspace((unsignedchar)c));
613593
casePG_REGEX_LOCALE_WIDE_L:
614-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
594+
#ifdefHAVE_LOCALE_T
615595
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
616596
returniswspace_l((wint_t)c,pg_regex_locale->info.lt);
617597
#endif
@@ -644,10 +624,8 @@ pg_wc_toupper(pg_wchar c)
644624
/* force C behavior for ASCII characters, per comments above */
645625
if (c <= (pg_wchar)127)
646626
returnpg_ascii_toupper((unsignedchar)c);
647-
#ifdefUSE_WIDE_UPPER_LOWER
648627
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
649628
returntowupper((wint_t)c);
650-
#endif
651629
/* FALL THRU */
652630
casePG_REGEX_LOCALE_1BYTE:
653631
/* force C behavior for ASCII characters, per comments above */
@@ -657,7 +635,7 @@ pg_wc_toupper(pg_wchar c)
657635
returntoupper((unsignedchar)c);
658636
returnc;
659637
casePG_REGEX_LOCALE_WIDE_L:
660-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
638+
#ifdefHAVE_LOCALE_T
661639
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
662640
returntowupper_l((wint_t)c,pg_regex_locale->info.lt);
663641
#endif
@@ -690,10 +668,8 @@ pg_wc_tolower(pg_wchar c)
690668
/* force C behavior for ASCII characters, per comments above */
691669
if (c <= (pg_wchar)127)
692670
returnpg_ascii_tolower((unsignedchar)c);
693-
#ifdefUSE_WIDE_UPPER_LOWER
694671
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
695672
returntowlower((wint_t)c);
696-
#endif
697673
/* FALL THRU */
698674
casePG_REGEX_LOCALE_1BYTE:
699675
/* force C behavior for ASCII characters, per comments above */
@@ -703,7 +679,7 @@ pg_wc_tolower(pg_wchar c)
703679
returntolower((unsignedchar)c);
704680
returnc;
705681
casePG_REGEX_LOCALE_WIDE_L:
706-
#if defined(HAVE_LOCALE_T)&& defined(USE_WIDE_UPPER_LOWER)
682+
#ifdefHAVE_LOCALE_T
707683
if (sizeof(wchar_t) >=4||c <= (pg_wchar)0xFFFF)
708684
returntowlower_l((wint_t)c,pg_regex_locale->info.lt);
709685
#endif

‎src/backend/tsearch/regis.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ RS_free(Regis *r)
178178
r->node=NULL;
179179
}
180180

181-
#ifdefUSE_WIDE_UPPER_LOWER
182181
staticbool
183182
mb_strchr(char*str,char*c)
184183
{
@@ -209,10 +208,6 @@ mb_strchr(char *str, char *c)
209208

210209
returnres;
211210
}
212-
#else
213-
#definemb_strchr(s,c)( (strchr((s),*(c)) == NULL) ? false : true )
214-
#endif
215-
216211

217212
bool
218213
RS_execute(Regis*r,char*str)

‎src/backend/tsearch/ts_locale.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
staticvoidtsearch_readline_callback(void*arg);
2222

2323

24-
#ifdefUSE_WIDE_UPPER_LOWER
25-
2624
int
2725
t_isdigit(constchar*ptr)
2826
{
@@ -86,7 +84,6 @@ t_isprint(const char *ptr)
8684

8785
returniswprint((wint_t)character[0]);
8886
}
89-
#endif/* USE_WIDE_UPPER_LOWER */
9087

9188

9289
/*
@@ -244,17 +241,12 @@ char *
244241
lowerstr_with_len(constchar*str,intlen)
245242
{
246243
char*out;
247-
248-
#ifdefUSE_WIDE_UPPER_LOWER
249244
Oidcollation=DEFAULT_COLLATION_OID;/* TODO */
250245
pg_locale_tmylocale=0;/* TODO */
251-
#endif
252246

253247
if (len==0)
254248
returnpstrdup("");
255249

256-
#ifdefUSE_WIDE_UPPER_LOWER
257-
258250
/*
259251
* Use wide char code only when max encoding length > 1 and ctype != C.
260252
* Some operating systems fail with multi-byte encodings and a C locale.
@@ -300,7 +292,6 @@ lowerstr_with_len(const char *str, int len)
300292
Assert(wlen<len);
301293
}
302294
else
303-
#endif/* USE_WIDE_UPPER_LOWER */
304295
{
305296
constchar*ptr=str;
306297
char*outptr;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp