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

Comparing Array-Heap/Heap.xs (file contents):
Revision 1.5 by root, Fri Apr 19 20:00:54 2013 UTC vs.
Revision 1.6 by root, Sun Apr 21 11:41:01 2013 UTC

271static SV * 271static SV *
272splice_heap (AV *av, f_cmp cmp, void *cmp_data, int idx, int flags) 272splice_heap (AV *av, f_cmp cmp, void *cmp_data, int idx, int flags)
273{ 273{
274 int len = AvFILLp (av); 274 int len = AvFILLp (av);
275 275
276 if (len < 0 || idx > len) 276 if (idx < 0 || idx > len)
277 return &PL_sv_undef; 277 return &PL_sv_undef;
278 else if (len == 0 || idx == len) 278 else if (idx == len)
279 return av_pop (av); /* the only or last element */ 279 return av_pop (av); /* the last element */
280 else 280 else
281 { 281 {
282 SV *top = av_pop (av); 282 SV *top = av_pop (av);
283 SV *result = AvARRAY (av)[idx]; 283 SV *result = AvARRAY (av)[idx];
284 AvARRAY (av)[idx] = top; 284 AvARRAY (av)[idx] = top;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines