summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-09-09 20:04:39 -0600
committerKarl Williamson <public@khwilliamson.com>2013-11-26 21:03:39 -0700
commit4f4ff3a7a93b5324d304037653dcc78e4cdc7cc1 (patch)
treef1c6fb3c153610df526cdd376fe466f873ce4fdc /mg.c
parent6c6eab558a00ed52629a7966596424346615a595 (diff)
downloadperl-4f4ff3a7a93b5324d304037653dcc78e4cdc7cc1.tar.gz
mg.c: Use $! code for $^E on platforms where are same
Only a few platforms have $^E distinguished from $!. On all others they should behave identically. Previous commits, have caused these to get out-of-sync. This causes them to share their code on platforms where they mean the same thing, so this won't happen again.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/mg.c b/mg.c
index 1f494dc33d..f914bee5d6 100644
--- a/mg.c
+++ b/mg.c
@@ -791,9 +791,11 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
if (nextchar != '\0') {
if (strEQ(remaining, "NCODING"))
sv_setsv(sv, PL_encoding);
+ break;
}
- else {
-#if defined(VMS)
+
+#if defined(VMS) || defined(OS2) || defined(WIN32)
+# if defined(VMS)
{
char msg[255];
$DESCRIPTOR(msgdsc,msg);
@@ -816,7 +818,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
sv_setnv(sv, (NV)Perl_rc);
sv_setpv(sv, os2error(Perl_rc));
}
-#elif defined(WIN32)
+# elif defined(WIN32)
{
const DWORD dwErr = GetLastError();
sv_setnv(sv, (NV)dwErr);
@@ -827,18 +829,14 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
sv_setpvs(sv, "");
SetLastError(dwErr);
}
-#else
- {
- dSAVE_ERRNO;
- sv_setnv(sv, (NV)errno);
- sv_setpv(sv, errno ? Strerror(errno) : "");
- RESTORE_ERRNO;
- }
-#endif
+# else
+# error Missing code for platform
+# endif
SvRTRIM(sv);
SvNOK_on(sv); /* what a wonderful hack! */
- }
break;
+#endif /* End of platforms with special handling for $^E; others just fall
+ through to $! */
case '!':
{