@@ -1649,7 +1649,7 @@ const char *find_commit_header(const char *msg, const char *key, size_t *out_len
1649
1649
}
1650
1650
1651
1651
/*
1652
- * Inspect sb and determine the true "end" of the log message, in
1652
+ * Inspect the given string and determine the true "end" of the log message, in
1653
1653
* order to find where to put a new Signed-off-by: line. Ignored are
1654
1654
* trailing comment lines and blank lines, and also the traditional
1655
1655
* "Conflicts:" block that is not commented out, so that we can use
@@ -1659,37 +1659,37 @@ const char *find_commit_header(const char *msg, const char *key, size_t *out_len
1659
1659
* Returns the number of bytes from the tail to ignore, to be fed as
1660
1660
* the second parameter to append_signoff().
1661
1661
*/
1662
- int ignore_non_trailer (struct strbuf * sb )
1662
+ int ignore_non_trailer (const char * buf , size_t len )
1663
1663
{
1664
1664
int boc = 0 ;
1665
1665
int bol = 0 ;
1666
1666
int in_old_conflicts_block = 0 ;
1667
1667
1668
- while (bol < sb -> len ) {
1669
- char * next_line ;
1668
+ while (bol < len ) {
1669
+ const char * next_line = memchr ( buf + bol , '\n' , len - bol ) ;
1670
1670
1671
- if (!( next_line = memchr ( sb -> buf + bol , '\n' , sb -> len - bol )) )
1672
- next_line = sb -> buf + sb -> len ;
1671
+ if (!next_line )
1672
+ next_line = buf + len ;
1673
1673
else
1674
1674
next_line ++ ;
1675
1675
1676
- if (sb -> buf [bol ] == comment_line_char || sb -> buf [bol ] == '\n' ) {
1676
+ if (buf [bol ] == comment_line_char || buf [bol ] == '\n' ) {
1677
1677
/* is this the first of the run of comments? */
1678
1678
if (!boc )
1679
1679
boc = bol ;
1680
1680
/* otherwise, it is just continuing */
1681
- } else if (starts_with (sb -> buf + bol , "Conflicts:\n" )) {
1681
+ } else if (starts_with (buf + bol , "Conflicts:\n" )) {
1682
1682
in_old_conflicts_block = 1 ;
1683
1683
if (!boc )
1684
1684
boc = bol ;
1685
- } else if (in_old_conflicts_block && sb -> buf [bol ] == '\t' ) {
1685
+ } else if (in_old_conflicts_block && buf [bol ] == '\t' ) {
1686
1686
; /* a pathname in the conflicts block */
1687
1687
} else if (boc ) {
1688
1688
/* the previous was not trailing comment */
1689
1689
boc = 0 ;
1690
1690
in_old_conflicts_block = 0 ;
1691
1691
}
1692
- bol = next_line - sb -> buf ;
1692
+ bol = next_line - buf ;
1693
1693
}
1694
- return boc ? sb -> len - boc : 0 ;
1694
+ return boc ? len - boc : 0 ;
1695
1695
}
0 commit comments