summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1996-09-30 01:13:28 -0400
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1996-09-30 01:13:28 -0400
commit946ec16ea935ac14ffffc87fcb9676a65aabcaa5 (patch)
tree516b626f53a12e729f4335f805961e7fec0cc2ed /mg.c
parent8595d6f1b81ebc9a9a406558f2d0cac4743b05e9 (diff)
downloadperl-946ec16ea935ac14ffffc87fcb9676a65aabcaa5.tar.gz
perl 5.003_06: mg.c
Restore the 5.003 gv_fullname() and gv_efullname() functions. Provide new 3-arg forms gv_fullname3() and gv_efullname3(). Date: Sun, 29 Sep 1996 22:18:19 -0400 (EDT) From: Chip Salzenberg <salzench@nielsenmedia.com> Subject: 5.003_05: Fix numeric value of $! This patch undoes a bit of over-zealous integerization in mg.c, related to the numeric value of $!. Date: Mon, 30 Sep 1996 01:13:28 -0400 From: Spider Boardman <spider@Orb.Nashua.NH.US> Subject: Re: pre extending hash? - need speed The patch below (which is relative to perl5.001l) implements "keys %hash = 50_000;" (or other integer-evaluable sizes) for pre-sizing hashes. I've only moved the patch forward from when I first did it. I'm sure the code in hv_ksplit could be improved. Date: Thu, 03 Oct 1996 16:31:46 -0400 (EDT) From: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU> Subject: VMS patches to 5.003_05 Date: Fri, 4 Oct 1996 12:38:31 -0400 (EDT) From: Chip Salzenberg <salzench@nielsenmedia.com> Subject: 5.003_05: Fix numeric $! and $^E This patch undoes a bit of over-zealous integerization in mg.c, related to the numeric values of $! and $^E. This patch *REPLACES* the one I posted earlier, which was only effective for $!. [Some of this is superceded by similar stuff in the VMS patches.]
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/mg.c b/mg.c
index bd3bd2ac63..934c776475 100644
--- a/mg.c
+++ b/mg.c
@@ -352,7 +352,7 @@ MAGIC *mg;
# include <starlet.h>
char msg[255];
$DESCRIPTOR(msgdsc,msg);
- sv_setiv(sv, (IV)vaxc$errno);
+ sv_setnv(sv,(double) vaxc$errno);
if (sys$getmsg(vaxc$errno,&msgdsc.dsc$w_length,&msgdsc,0,0) & 1)
sv_setpvn(sv,msgdsc.dsc$a_pointer,msgdsc.dsc$w_length);
else
@@ -360,14 +360,14 @@ MAGIC *mg;
}
#else
#ifdef OS2
- sv_setiv(sv, (IV)Perl_rc);
+ sv_setnv(sv, (double)Perl_rc);
sv_setpv(sv, os2error(Perl_rc));
#else
- sv_setiv(sv, (IV)errno);
+ sv_setnv(sv, (double)errno);
sv_setpv(sv, errno ? Strerror(errno) : "");
#endif
#endif
- SvIOK_on(sv); /* what a wonderful hack! */
+ SvNOK_on(sv); /* what a wonderful hack! */
break;
case '\006': /* ^F */
sv_setiv(sv, (IV)maxsysfd);
@@ -506,12 +506,12 @@ MAGIC *mg;
break;
case '!':
#ifdef VMS
- sv_setiv(sv, (IV)((errno == EVMSERR) ? vaxc$errno : errno));
+ sv_setnv(sv, (double)((errno == EVMSERR) ? vaxc$errno : errno));
sv_setpv(sv, errno ? Strerror(errno) : "");
#else
{
int saveerrno = errno;
- sv_setiv(sv, (IV)errno);
+ sv_setnv(sv, (double)errno);
#ifdef OS2
if (errno == errno_isOS2) sv_setpv(sv, os2error(Perl_rc));
else
@@ -520,7 +520,7 @@ MAGIC *mg;
errno = saveerrno;
}
#endif
- SvIOK_on(sv); /* what a wonderful hack! */
+ SvNOK_on(sv); /* what a wonderful hack! */
break;
case '<':
sv_setiv(sv, (IV)uid);
@@ -551,7 +551,7 @@ MAGIC *mg;
}
#endif
sv_setpv(sv,buf);
- SvIOK_on(sv); /* what a wonderful hack! */
+ SvNOK_on(sv); /* what a wonderful hack! */
break;
case '*':
break;
@@ -815,6 +815,18 @@ MAGIC* mg;
}
#endif /* OVERLOAD */
+int
+magic_setnkeys(sv,mg)
+SV* sv;
+MAGIC* mg;
+{
+ if (LvTARG(sv)) {
+ hv_ksplit((HV*)LvTARG(sv), SvIV(sv));
+ LvTARG(sv) = Nullsv; /* Don't allow a ref to reassign this. */
+ }
+ return 0;
+}
+
static int
magic_methpack(sv,mg,meth)
SV* sv;
@@ -1042,11 +1054,11 @@ MAGIC* mg;
{
if (SvFAKE(sv)) { /* FAKE globs can get coerced */
SvFAKE_off(sv);
- gv_efullname(sv,((GV*)sv), "*");
+ gv_efullname3(sv,((GV*)sv), "*");
SvFAKE_on(sv);
}
else
- gv_efullname(sv,((GV*)sv), "*"); /* a gv value, be nice */
+ gv_efullname3(sv,((GV*)sv), "*"); /* a gv value, be nice */
return 0;
}