ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/CBOR-XS/XS.xs
(Generate patch)

Comparing CBOR-XS/XS.xs (file contents):
Revision 1.64 by root, Tue Jun 27 02:03:24 2017 UTC vs.
Revision 1.65 by root, Thu Nov 15 19:52:41 2018 UTC

510 else if ((method = gv_fetchmethod_autoload (stash, "FREEZE", 0)) != 0) 510 else if ((method = gv_fetchmethod_autoload (stash, "FREEZE", 0)) != 0)
511 { 511 {
512 dSP; 512 dSP;
513 513
514 ENTER; SAVETMPS; 514 ENTER; SAVETMPS;
515 SAVESTACK_POS ();
516 PUSHMARK (SP); 515 PUSHMARK (SP);
517 EXTEND (SP, 2); 516 EXTEND (SP, 2);
518 // we re-bless the reference to get overload and other niceties right 517 // we re-bless the reference to get overload and other niceties right
519 PUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash)); 518 PUSHs (sv_bless (sv_2mortal (newRV_inc (sv)), stash));
520 PUSHs (sv_cbor); 519 PUSHs (sv_cbor);
529 528
530 encode_tag (enc, CBOR_TAG_PERL_OBJECT); 529 encode_tag (enc, CBOR_TAG_PERL_OBJECT);
531 encode_uint (enc, MAJOR_ARRAY, count + 1); 530 encode_uint (enc, MAJOR_ARRAY, count + 1);
532 encode_strref (enc, 0, HvNAMEUTF8 (stash), HvNAME (stash), HvNAMELEN (stash)); 531 encode_strref (enc, 0, HvNAMEUTF8 (stash), HvNAME (stash), HvNAMELEN (stash));
533 532
534 while (count) 533 {
534 int i;
535
536 for (i = 0; i < count; ++i)
535 encode_sv (enc, SP[1 - count--]); 537 encode_sv (enc, SP[i + 1 - count]);
538
539 SP -= count;
540 }
536 541
537 PUTBACK; 542 PUTBACK;
538 543
539 FREETMPS; LEAVE; 544 FREETMPS; LEAVE;
540 } 545 }
1141 1146
1142 sv = decode_sv (dec); 1147 sv = decode_sv (dec);
1143 1148
1144 dSP; 1149 dSP;
1145 ENTER; SAVETMPS; 1150 ENTER; SAVETMPS;
1146 SAVESTACK_POS ();
1147 PUSHMARK (SP); 1151 PUSHMARK (SP);
1148 EXTEND (SP, 2); 1152 EXTEND (SP, 2);
1149 PUSHs (tag_sv); 1153 PUSHs (tag_sv);
1150 PUSHs (sv); 1154 PUSHs (sv);
1151 1155
1162 1166
1163 if (count) 1167 if (count)
1164 { 1168 {
1165 SvREFCNT_dec_NN (tag_sv); 1169 SvREFCNT_dec_NN (tag_sv);
1166 SvREFCNT_dec_NN (sv); 1170 SvREFCNT_dec_NN (sv);
1167 sv = SvREFCNT_inc_NN (POPs); 1171 sv = SvREFCNT_inc_NN (TOPs);
1172 SP -= count;
1168 } 1173 }
1169 else 1174 else
1170 { 1175 {
1171 AV *av = newAV (); 1176 AV *av = newAV ();
1172 av_push (av, tag_sv); 1177 av_push (av, tag_sv);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines