summaryrefslogtreecommitdiff
path: root/utf8.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-02-06 09:55:58 -0700
committerKarl Williamson <public@khwilliamson.com>2011-02-06 10:02:10 -0700
commitb443038a145a59ec6de84fc1eeb3034b20299069 (patch)
treec2c9a8e40dcaa0d62377a9d11b75f919eeb8750d /utf8.c
parentb9d2ea5ba3215af3e27ecf994cfded2599a1d4d2 (diff)
downloadperl-b443038a145a59ec6de84fc1eeb3034b20299069.tar.gz
Silence compile warnings before uni tables built
The recent move of Unicode folding to the compilation phase caused spurious warnings during the miniperl build phase of Perl itself before the Unicode tables get built. Before the tables are built, Perl is unable to know about the Unicode semantics (it has ASCII/Latin1 hard-coded in), but was still trying to access the tables. Now, it checks and if the tables aren't present uses just the hard-coded ASCII/Latin1 semantics.
Diffstat (limited to 'utf8.c')
-rw-r--r--utf8.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/utf8.c b/utf8.c
index 6053465802..f6cdba28e0 100644
--- a/utf8.c
+++ b/utf8.c
@@ -2719,6 +2719,7 @@ Perl__swash_to_invlist(pTHX_ SV* const swash)
STRLEN lcur;
HV *const hv = MUTABLE_HV(SvRV(swash));
UV elements = 0; /* Number of elements in the inversion list */
+ U8 empty[] = "";
/* The string containing the main body of the table */
SV** const listsvp = hv_fetchs(hv, "LIST", FALSE);
@@ -2734,7 +2735,16 @@ Perl__swash_to_invlist(pTHX_ SV* const swash)
PERL_ARGS_ASSERT__SWASH_TO_INVLIST;
/* read $swash->{LIST} */
- l = (U8*)SvPV(*listsvp, lcur);
+ if (SvPOK(*listsvp)) {
+ l = (U8*)SvPV(*listsvp, lcur);
+ }
+ else {
+ /* LIST legitimately doesn't contain a string during compilation phases
+ * of Perl itself, before the Unicode tables are generated. In this
+ * case, just fake things up by creating an empty list */
+ l = empty;
+ lcur = 0;
+ }
loc = (char *) l;
lend = l + lcur;