@@ -521,7 +521,7 @@ bool DCV_connect_with_base(DeltaChunkVector* tdcv, const DeltaChunkVector* bdcv)
521521 DBG_check (tdcv );
522522 DBG_check (bdcv );
523523
524- uint * offset_array = PyMem_Malloc (tdcv -> size * sizeof (uint ));
524+ uint * const offset_array = PyMem_Malloc (tdcv -> size * sizeof (uint ));
525525 if (!offset_array ){
526526 return 0 ;
527527 }
@@ -531,7 +531,6 @@ bool DCV_connect_with_base(DeltaChunkVector* tdcv, const DeltaChunkVector* bdcv)
531531
532532 DeltaChunk * dc = DCV_first (tdcv );
533533 const DeltaChunk * dcend = DCV_end (tdcv );
534- const ull oldsize = DCV_size (tdcv );
535534
536535 // OFFSET RUN
537536 for (;dc < dcend ; dc ++ , pofs ++ )
@@ -563,9 +562,10 @@ bool DCV_connect_with_base(DeltaChunkVector* tdcv, const DeltaChunkVector* bdcv)
563562 // Data chunks don't need processing
564563 const uint ofs = * pofs ;
565564 if (dc -> data ){
566- // TODO: peak the preceeding chunks to figure out whether they are
565+ // NOTE: could peek the preceeding chunks to figure out whether they are
567566 // all just moved by ofs. In that case, they can move as a whole!
568- // just copy the chunk according to its offset
567+ // tests showed that this is very rare though, even in huge deltas, so its
568+ // not worth the extra effort
569569 if (ofs ){
570570 memcpy ((void * )(dc + ofs ), (void * )dc , sizeof (DeltaChunk ));
571571 }
@@ -584,7 +584,6 @@ bool DCV_connect_with_base(DeltaChunkVector* tdcv, const DeltaChunkVector* bdcv)
584584 }
585585
586586 DBG_check (tdcv );
587- assert (DCV_size (tdcv ) == oldsize );
588587
589588 PyMem_Free (offset_array );
590589 return 1 ;
0 commit comments