diff options
author | Karl Williamson <khw@cpan.org> | 2022-06-11 04:40:17 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-06-11 04:50:12 -0600 |
commit | 12865d70b33295cc1e31678404f5aef517d3a97b (patch) | |
tree | 510bc0e44e1f0c2bf77d9e3d64f8901fb311a9b2 /mg.c | |
parent | d7facc808f155e75c17b5897933d29cf5052c5fd (diff) | |
download | perl-12865d70b33295cc1e31678404f5aef517d3a97b.tar.gz |
mg.c: Fix to compile under g++
Commit 00a5df846e035280750985222a693ac58022ee36 fixed some c undefined
behavior, but it will not compile with g++, because a goto crosses
initialization.
https://stackoverflow.com/questions/14274225/statement-goto-can-not-cross-variable-definition
and its links sort of explains why
This commit works around this limitation
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -867,6 +867,10 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) PERL_ARGS_ASSERT_MAGIC_GET; + const char * const remaining = (mg->mg_ptr) + ? mg->mg_ptr + 1 + : NULL; + if (!mg->mg_ptr) { paren = mg->mg_len; if (PL_curpm && (rx = PM_GETRE(PL_curpm))) { @@ -878,8 +882,6 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) return 0; } - const char * const remaining = mg->mg_ptr + 1; - nextchar = *remaining; switch (*mg->mg_ptr) { case '\001': /* ^A */ |