summaryrefslogtreecommitdiff
path: root/av.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-02-18 19:40:43 +0000
committerNicholas Clark <nick@ccl4.org>2007-02-18 19:40:43 +0000
commitb9f83d2f7c4cb24d96302c6fcaa5e60628fad1f8 (patch)
tree65417bf74a7dc6b1ad198dcf0f64abbe38d16a66 /av.c
parentbe2b1c742382f74864880924170180bbe1904463 (diff)
downloadperl-b9f83d2f7c4cb24d96302c6fcaa5e60628fad1f8.tar.gz
Add a new API function newSV_type, to replace the idiom:
sv = newSV(0); sv_upgrade(sv, type); p4raw-id: //depot/perl@30347
Diffstat (limited to 'av.c')
-rw-r--r--av.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/av.c b/av.c
index c6677a9ed8..39b4b7d327 100644
--- a/av.c
+++ b/av.c
@@ -362,9 +362,7 @@ Creates a new AV. The reference count is set to 1.
AV *
Perl_newAV(pTHX)
{
- register AV * const av = (AV*)newSV(0);
-
- sv_upgrade((SV *)av, SVt_PVAV);
+ register AV * const av = (AV*)newSV_type(SVt_PVAV);
/* sv_upgrade does AvREAL_only() */
AvALLOC(av) = 0;
AvARRAY(av) = NULL;
@@ -385,9 +383,7 @@ will have a reference count of 1.
AV *
Perl_av_make(pTHX_ register I32 size, register SV **strp)
{
- register AV * const av = (AV*)newSV(0);
-
- sv_upgrade((SV *) av,SVt_PVAV);
+ register AV * const av = (AV*)newSV_type(SVt_PVAV);
/* sv_upgrade does AvREAL_only() */
if (size) { /* "defined" was returning undef for size==0 anyway. */
register SV** ary;