@@ -658,8 +658,11 @@ static struct origin *find_rename(struct scoreboard *sb,
658
658
/*
659
659
* Append a new blame entry to a given output queue.
660
660
*/
661
- static void add_blame_entry (struct blame_entry * * * queue , struct blame_entry * e )
661
+ static void add_blame_entry (struct blame_entry * * * queue ,
662
+ const struct blame_entry * src )
662
663
{
664
+ struct blame_entry * e = xmalloc (sizeof (* e ));
665
+ memcpy (e , src , sizeof (* e ));
663
666
origin_incref (e -> suspect );
664
667
665
668
e -> next = * * queue ;
@@ -760,21 +763,15 @@ static void split_blame(struct blame_entry ***blamed,
760
763
struct blame_entry * split ,
761
764
struct blame_entry * e )
762
765
{
763
- struct blame_entry * new_entry ;
764
-
765
766
if (split [0 ].suspect && split [2 ].suspect ) {
766
767
/* The first part (reuse storage for the existing entry e) */
767
768
dup_entry (unblamed , e , & split [0 ]);
768
769
769
770
/* The last part -- me */
770
- new_entry = xmalloc (sizeof (* new_entry ));
771
- memcpy (new_entry , & (split [2 ]), sizeof (struct blame_entry ));
772
- add_blame_entry (unblamed , new_entry );
771
+ add_blame_entry (unblamed , & split [2 ]);
773
772
774
773
/* ... and the middle part -- parent */
775
- new_entry = xmalloc (sizeof (* new_entry ));
776
- memcpy (new_entry , & (split [1 ]), sizeof (struct blame_entry ));
777
- add_blame_entry (blamed , new_entry );
774
+ add_blame_entry (blamed , & split [1 ]);
778
775
}
779
776
else if (!split [0 ].suspect && !split [2 ].suspect )
780
777
/*
@@ -785,18 +782,12 @@ static void split_blame(struct blame_entry ***blamed,
785
782
else if (split [0 ].suspect ) {
786
783
/* me and then parent */
787
784
dup_entry (unblamed , e , & split [0 ]);
788
-
789
- new_entry = xmalloc (sizeof (* new_entry ));
790
- memcpy (new_entry , & (split [1 ]), sizeof (struct blame_entry ));
791
- add_blame_entry (blamed , new_entry );
785
+ add_blame_entry (blamed , & split [1 ]);
792
786
}
793
787
else {
794
788
/* parent and then me */
795
789
dup_entry (blamed , e , & split [1 ]);
796
-
797
- new_entry = xmalloc (sizeof (* new_entry ));
798
- memcpy (new_entry , & (split [2 ]), sizeof (struct blame_entry ));
799
- add_blame_entry (unblamed , new_entry );
790
+ add_blame_entry (unblamed , & split [2 ]);
800
791
}
801
792
}
802
793
0 commit comments