This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5a5:pat/inherit.pat
[perl5.git] / save_ary.bad
CommitLineData
79072805
LW
1AV *
2save_ary(av)
3AV *av;
4{
5 register SV *sv;
6
7 sv = NEWSV(10,0);
8 sv->sv_state = SVs_SARY;
9 sv_setpv(sv, (char*)av, sizeof(AV));
10
11 av->av_sv.sv_rare = AVf_REAL;
12 av->av_magic = NEWSV(7,0);
13 av->av_alloc = av->av_array = 0;
14 /* sv_magic(av->av_magic, gv, '#', Nullch, 0); */
15 av->av_max = av->av_fill = -1;
16
17 sv->sv_u.sv_av = av;
18 (void)av_push(savestack,sv); /* save array ptr */
19 return av;
20}
21
22HV *
23save_hash(hv)
24HV *hv;
25{
26 register SV *sv;
27
28 sv = NEWSV(11,0);
29 sv->sv_state = SVs_SHASH;
30 sv_setpv(sv, (char*)hv, sizeof(HV));
31
32 hv->hv_array = 0;
33 hv->hv_max = 7;
34 hv->hv_dosplit = hv->hv_max * FILLPCT / 100;
35 hv->hv_fill = 0;
36#ifdef SOME_DBM
37 hv->hv_dbm = 0;
38#endif
39 (void)hv_iterinit(hv); /* so each() will start off right */
40
41 sv->sv_u.sv_hv = hv;
42 (void)av_push(savestack,sv); /* save hash ptr */
43 return hv;
44}