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.77 by root, Fri Sep 8 05:47:10 2023 UTC vs.
Revision 1.78 by root, Fri Sep 8 06:01:12 2023 UTC

1201 // if cycles are allowed, then we store an AV as value 1201 // if cycles are allowed, then we store an AV as value
1202 // while it is being decoded, and gather unresolved 1202 // while it is being decoded, and gather unresolved
1203 // references in it, to be re4solved after decoding. 1203 // references in it, to be re4solved after decoding.
1204 int idx, i; 1204 int idx, i;
1205 AV *av = newAV (); 1205 AV *av = newAV ();
1206 av_push (dec->shareable, SvREFCNT_inc_NN ((SV *)av)); 1206 av_push (dec->shareable, (SV *)av);
1207 idx = AvFILLp (dec->shareable); 1207 idx = AvFILLp (dec->shareable);
1208 1208
1209 sv = decode_sv (dec); 1209 sv = decode_sv (dec);
1210 1210
1211 // the AV now contains \undef for all unresolved references, 1211 // the AV now contains \undef for all unresolved references,
1212 // so we fix them up here. 1212 // so we fix them up here.
1213 for (i = 0; i <= AvFILLp (av); ++i) 1213 for (i = 0; i <= AvFILLp (av); ++i)
1214 SvRV_set (AvARRAY (av)[i], SvREFCNT_inc_NN (SvRV (sv))); 1214 SvRV_set (AvARRAY (av)[i], SvREFCNT_inc_NN (SvRV (sv)));
1215 1215
1216 // now replace the AV by a reference to the completed value 1216 // now replace the AV by a reference to the completed value
1217 SvREFCNT_dec_NN (av); 1217 SvREFCNT_dec_NN ((SV *)av);
1218 AvARRAY (dec->shareable)[idx] = SvREFCNT_inc_NN (sv); 1218 AvARRAY (dec->shareable)[idx] = SvREFCNT_inc_NN (sv);
1219 } 1219 }
1220 else 1220 else
1221 { 1221 {
1222 av_push (dec->shareable, &PL_sv_undef); 1222 av_push (dec->shareable, &PL_sv_undef);
1223 int idx = AvFILLp (dec->shareable); 1223 int idx = AvFILLp (dec->shareable);
1224 sv = decode_sv (dec); 1224 sv = decode_sv (dec);
1225 av_store (dec->shareable, idx, SvREFCNT_inc_NN (sv)); 1225 AvARRAY (dec->shareable)[idx] = SvREFCNT_inc_NN (sv);
1226 } 1226 }
1227 } 1227 }
1228 break; 1228 break;
1229 1229
1230 case CBOR_TAG_VALUE_SHAREDREF: 1230 case CBOR_TAG_VALUE_SHAREDREF:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines