diff options
author | Perl 5 Porters <perl5-porters@africa.nicoh.com> | 1996-11-30 05:31:00 +1200 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1996-11-30 05:31:00 +1200 |
commit | ff68c7194e176ca1907544a3a65684b76834d0fe (patch) | |
tree | 4124d603a6b2a937f4ce1d9469426f84421f93e0 /hv.c | |
parent | eff9c6e2f5bda63e4dc69fc15e237a9843954369 (diff) | |
download | perl-ff68c7194e176ca1907544a3a65684b76834d0fe.tar.gz |
[inseparable changes from patch from perl5.003_09 to perl5.003_10]
CORE LANGUAGE CHANGES
Subject: Allow &{sub {...}} without warning
From: Chip Salzenberg <chip@atlantic.net>
Files: toke.c
Subject: Make parens optional on [gs]ethost and [gs]et{pw,gr} function
From: Chip Salzenberg <chip@atlantic.net>
Files: toke.c
Subject: Fix syntax error with "$x [0]" and "$x {y}" and "@x {y}"
From: Chip Salzenberg <chip@atlantic.net>
Files: toke.c
DOCUMENTATION
Subject: Improve documentation for sysread() and syswrite()
From: Chip Salzenberg <chip@atlantic.net>
Files: pod/perlfunc.pod
Subject: Document how to use $SIG{ALRM} and alarm()
Date: Tue, 26 Nov 1996 11:42:49 -0500
From: Roderick Schertler <roderick@ibcinc.com>
Files: pod/perlfunc.pod
Msg-ID: <5898.849026569@eeyore.ibcinc.com>
(applied based on p5p patch as commit 5fa5e7dfc2abaaadd377c97cd1ebe78ea844da88)
OTHER CORE CHANGES
Subject: Hash key memory corruption fix and naming cleanup
From: Chip Salzenberg <chip@atlantic.net>
Files: hv.c hv.h perl.h
Subject: Undo broken perf. patch (PADTMP stealing)
From: Chip Salzenberg <chip@atlantic.net>
Files: sv.c
Subject: Make SV unstudied in sv_gets()
From: Chip Salzenberg <chip@atlantic.net>
Files: sv.c
Subject: Better support for UVs
From: Paul Marquess <pmarquess@bfsec.bt.co.uk>
Files: global.sym old_global.sym perl.h pp.c pp.h proto.h sv.c sv.h
Subject: Minor locale cleanups
From: Chip Salzenberg <chip@atlantic.net>
Files: t/lib/posix.t util.c
Accept "POSIX" locale as standard like "C". Reset locale to
'C' when testing strtod() in t/lib/posix.t.
Subject: Always taint result of sprintf() on float
From: Chip Salzenberg <chip@atlantic.net>
Files: doop.c
Subject: Fix spurious warning from bitwise string ops
From: Chip Salzenberg <chip@atlantic.net>
Files: doop.c
Subject: Eliminate warning on {,sys}read(,$newvar,)
From: Chip Salzenberg <chip@atlantic.net>
Files: doop.c pp_sys.c
Subject: Namespace cleanup
From: Chip Salzenberg <chip@atlantic.net>
Files: global.sym old_global.sym perl.h
Subject: Modify perl_exp.SH; create old_perl_exp.SH; document old_*
From: Chip Salzenberg <chip@atlantic.net>
Files: Configure INSTALL MANIFEST old_perl_exp.SH perl_exp.SH
PORTABILITY
Subject: Reliable signal patch
Date: Tue, 26 Nov 1996 05:40:50 -0500 (EST)
From: Kenneth Albanowski <kjahds@kjahds.com>
Files: global.sym mg.c old_global.sym perl.h pp_sys.c proto.h util.c
Msg-ID: <Pine.LNX.3.93.961126053209.294J-100000@kjahds.com>
(applied based on p5p patch as commit 679728958e74b0ccd6d61567d84851f1ef994e1f)
Subject: Emulate missing flock() with either fcntl() or lockf()
From: Chip Salzenberg <chip@atlantic.net>
Files: pp_sys.c
Subject: 3_09: minor patches for OS/2
Date: Wed, 27 Nov 1996 03:30:05 -0500 (EST)
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Files: doio.c global.sym malloc.c old_global.sym os2/Makefile.SHs os2/OS2/ExtAttr/Makefile.PL os2/OS2/PrfDB/Makefile.PL os2/OS2/Process/Makefile.PL os2/OS2/REXX/Makefile.PL os2/os2.c os2/os2ish.h perl.h
Subject: 3_09: minor patches
This patches mostly enable commpilation under OS/2, and fix malloc.c.
Enjoy,
p5p-msgid: <199611270830.DAA04985@monk.mps.ohio-state.edu>
Subject: Re: 5.003_09 and QNX
Date: Wed, 27 Nov 96 13:36:06 est
From: Norton Allen <nort@bottesini.harvard.edu>
Files: Configure MANIFEST README.qnx hints/qnx.sh qnx/ar qnx/cpp t/TEST toke.c util.c x2p/proto.h
Msg-ID: <9611271836.AA14460@bottesini.harvard.edu>
(applied based on p5p patch as commit c5117498be098729dc2af28089bd130c88c8d42b)
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 58 |
1 files changed, 32 insertions, 26 deletions
@@ -64,12 +64,12 @@ U32 hash; char *k; register HEK *hek; - New(54, k, sizeof(U32) + sizeof(I32) + len + 1, char); + New(54, k, HEK_BASESIZE + len + 1, char); hek = (HEK*)k; - Copy(str, HK_KEY(hek), len, char); - (HK_KEY(hek))[len] = '\0'; - HK_LEN(hek) = len; - HK_HASH(hek) = hash; + Copy(str, HEK_KEY(hek), len, char); + *(HEK_KEY(hek) + len) = '\0'; + HEK_LEN(hek) = len; + HEK_HASH(hek) = hash; return hek; } @@ -77,7 +77,7 @@ void unshare_hek(hek) HEK *hek; { - unsharepvn(HK_KEY(hek),HK_LEN(hek),HK_HASH(hek)); + unsharepvn(HEK_KEY(hek),HEK_LEN(hek),HEK_HASH(hek)); } /* (klen == HEf_SVKEY) is special for MAGICAL hv entries, meaning key slot @@ -168,14 +168,17 @@ register U32 hash; return 0; if (SvRMAGICAL(hv) && mg_find((SV*)hv,'P')) { + char *k; HEK *hek; - Newz(74, hek, 1, HEK); + + New(54, k, HEK_BASESIZE + sizeof(SV*), char); + hek = (HEK*)k; sv = sv_newmortal(); keysv = sv_2mortal(newSVsv(keysv)); mg_copy((SV*)hv, sv, (char*)keysv, HEf_SVKEY); entry = &He; HeVAL(entry) = sv; - HeKEY_hk(entry) = hek; + HeKEY_hek(entry) = hek; HeSVKEY_set(entry, keysv); HeKLEN(entry) = HEf_SVKEY; /* hent_key is holding an SV* */ return entry; @@ -277,9 +280,9 @@ register U32 hash; entry = new_he(); if (HvSHAREKEYS(hv)) - HeKEY_hk(entry) = share_hek(key, klen, hash); + HeKEY_hek(entry) = share_hek(key, klen, hash); else /* gotta do the real thing */ - HeKEY_hk(entry) = save_hek(key, klen, hash); + HeKEY_hek(entry) = save_hek(key, klen, hash); HeVAL(entry) = val; HeNEXT(entry) = *oentry; *oentry = entry; @@ -350,9 +353,9 @@ register U32 hash; entry = new_he(); if (HvSHAREKEYS(hv)) - HeKEY_hk(entry) = share_hek(key, klen, hash); + HeKEY_hek(entry) = share_hek(key, klen, hash); else /* gotta do the real thing */ - HeKEY_hk(entry) = save_hek(key, klen, hash); + HeKEY_hek(entry) = save_hek(key, klen, hash); HeVAL(entry) = val; HeNEXT(entry) = *oentry; *oentry = entry; @@ -752,11 +755,11 @@ I32 shared; SvREFCNT_dec(HeVAL(hent)); if (HeKLEN(hent) == HEf_SVKEY) { SvREFCNT_dec(HeKEY_sv(hent)); - Safefree(HeKEY_hk(hent)); + Safefree(HeKEY_hek(hent)); } else if (shared) - unshare_hek(HeKEY_hk(hent)); + unshare_hek(HeKEY_hek(hent)); else - Safefree(HeKEY_hk(hent)); + Safefree(HeKEY_hek(hent)); del_he(hent); } @@ -770,11 +773,11 @@ I32 shared; sv_2mortal(HeVAL(hent)); /* free between statements */ if (HeKLEN(hent) == HEf_SVKEY) { sv_2mortal(HeKEY_sv(hent)); - Safefree(HeKEY_hk(hent)); + Safefree(HeKEY_hek(hent)); } else if (shared) - unshare_hek(HeKEY_hk(hent)); + unshare_hek(HeKEY_hek(hent)); else - Safefree(HeKEY_hk(hent)); + Safefree(HeKEY_hek(hent)); del_he(hent); } @@ -894,11 +897,14 @@ HV *hv; SvREFCNT_dec(HeSVKEY(entry)); /* get rid of previous key */ } else { + char *k; HEK *hek; - xhv->xhv_eiter = entry = new_he(); /* only one HE per MAGICAL hash */ + + xhv->xhv_eiter = entry = new_he(); /* one HE per MAGICAL hash */ Zero(entry, 1, HE); - Newz(74, hek, 1, HEK); - HeKEY_hk(entry) = hek; + Newz(54, k, HEK_BASESIZE + sizeof(SV*), char); + hek = (HEK*)k; + HeKEY_hek(entry) = hek; HeKLEN(entry) = HEf_SVKEY; } magic_nextpack((SV*) hv,mg,key); @@ -909,7 +915,7 @@ HV *hv; } if (HeVAL(entry)) SvREFCNT_dec(HeVAL(entry)); - Safefree(HeKEY_hk(entry)); + Safefree(HeKEY_hek(entry)); del_he(entry); xhv->xhv_eiter = Null(HE*); return Null(HE*); @@ -1008,7 +1014,7 @@ char* sv; I32 len; U32 hash; { - return share_hek(sv, len, hash)->hk_key; + return HEK_KEY(share_hek(sv, len, hash)); } /* possibly free a shared string if no one has access to it @@ -1046,7 +1052,7 @@ U32 hash; *oentry = HeNEXT(entry); if (i && !*oentry) xhv->xhv_fill--; - Safefree(HeKEY_hk(entry)); + Safefree(HeKEY_hek(entry)); del_he(entry); --xhv->xhv_keys; } @@ -1093,7 +1099,7 @@ register U32 hash; } if (!found) { entry = new_he(); - HeKEY_hk(entry) = save_hek(str, len, hash); + HeKEY_hek(entry) = save_hek(str, len, hash); HeVAL(entry) = Nullsv; HeNEXT(entry) = *oentry; *oentry = entry; @@ -1106,7 +1112,7 @@ register U32 hash; } ++HeVAL(entry); /* use value slot as REFCNT */ - return HeKEY_hk(entry); + return HeKEY_hek(entry); } |