summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-06-18 16:33:01 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-06-18 16:33:01 +0000
commit00db4c452819e776e72467584ab4e9617d012f7b (patch)
treea0211b478efd413d7b381a4a612d15e1a33036d8 /sv.c
parent3b818b81e61465ce5ae6f7c21e6ca3b83d30216e (diff)
downloadperl-00db4c452819e776e72467584ab4e9617d012f7b.tar.gz
fix memory leaks and uninitialized memory accesses found by Purify
p4raw-id: //depot/perl@1143
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sv.c b/sv.c
index 8c7d9c2a3b..df3fbe3aeb 100644
--- a/sv.c
+++ b/sv.c
@@ -96,17 +96,17 @@ typedef void (*SVFUNC) _((SV*));
} while (0)
static SV **registry;
-static I32 regsize;
+static I32 registry_size;
#define REGHASH(sv,size) ((((U32)(sv)) >> 2) % (size))
#define REG_REPLACE(sv,a,b) \
do { \
void* p = sv->sv_any; \
- I32 h = REGHASH(sv, regsize); \
+ I32 h = REGHASH(sv, registry_size); \
I32 i = h; \
while (registry[i] != (a)) { \
- if (++i >= regsize) \
+ if (++i >= registry_size) \
i = 0; \
if (i == h) \
die("SV registry bug"); \
@@ -121,13 +121,13 @@ static void
reg_add(sv)
SV* sv;
{
- if (sv_count >= (regsize >> 1))
+ if (sv_count >= (registry_size >> 1))
{
SV **oldreg = registry;
- I32 oldsize = regsize;
+ I32 oldsize = registry_size;
- regsize = regsize ? ((regsize << 2) + 1) : 2037;
- Newz(707, registry, regsize, SV*);
+ registry_size = registry_size ? ((registry_size << 2) + 1) : 2037;
+ Newz(707, registry, registry_size, SV*);
if (oldreg) {
I32 i;
@@ -159,9 +159,9 @@ SVFUNC f;
{
I32 i;
- for (i = 0; i < regsize; ++i) {
+ for (i = 0; i < registry_size; ++i) {
SV* sv = registry[i];
- if (sv)
+ if (sv && SvTYPE(sv) != SVTYPEMASK)
(*f)(sv);
}
}