This code sequence is somewhat difficult to read. Let's rewrite it using more descriptive variable names to try to make it easier to understand. Signed-off-by: Brandon Casey <drafnel@xxxxxxxxx> --- sequencer.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sequencer.c b/sequencer.c index aef5e8a..cd211b2 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1024,16 +1024,19 @@ int sequencer_pick_revisions(struct replay_opts *opts) static int ends_rfc2822_footer(struct strbuf *sb, int ignore_footer) { int ch; - int hit = 0; + int last_char_was_nl, this_char_is_nl; int i, j, k; int len = sb->len - ignore_footer; int first = 1; const char *buf = sb->buf; + /* find start of last paragraph */ + last_char_was_nl = 0; for (i = len - 1; i > 0; i--) { - if (hit && buf[i] == '\n') + this_char_is_nl = (buf[i] == '\n'); + if (last_char_was_nl && this_char_is_nl) break; - hit = (buf[i] == '\n'); + last_char_was_nl = this_char_is_nl; } while (i < len - 1 && buf[i] == '\n') -- 1.8.1.1.450.g0327af3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html