From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 99FBF20209 for ; Wed, 24 May 2017 21:41:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164144AbdEXVlm (ORCPT ); Wed, 24 May 2017 17:41:42 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:36449 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164154AbdEXVk5 (ORCPT ); Wed, 24 May 2017 17:40:57 -0400 Received: by mail-pf0-f170.google.com with SMTP id m17so147397555pfg.3 for ; Wed, 24 May 2017 14:40:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ojHg7GpKiHrWwSPsBjqao/bKSnSzitciM1YWPr+aYac=; b=QA4Db7YhbVVcrd4HKL2rnPqPAUZvHEbhxOvQYD1ZxbAf1H7lyLIHdDJE4h6/LaCGqz tehbw58QqZds5rTQIcnnGgvOnzpAMrHuSMjK7L1DZgGT/pFt27Yy24S9UiuVlbzO9qW0 vxKCDoNu/IkMWwJuCa3fq9xpEe79ce820EPuhd4Xxo2lpWr1Nh9d2wae01bDSY9Oq7bF HSFiwrjxDOtSGAR4wefjFFswPB5DEp6r4u+ZPbnxKk9qfcicZ0L4GQkFQYfLkNCwRpd0 wJH2ATsH972alEgafb1B0+SbUvyxhXQtQZjo5AsMnIUPdyKvMQ0sagXu3WK8OlbHXNj9 wEwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ojHg7GpKiHrWwSPsBjqao/bKSnSzitciM1YWPr+aYac=; b=gxCTHF3MLEWo2IF8tMXOh9YX+o2hKXVZygPhFJJKESWCp/VpPdxi8XZnef+MJod6Kx ne/DHX3beZzOBYanq4Gexnqk32po0hVIk3M2taQ6zxDzbJ/1xa8l3IsyTFulJR4RggDe B4Nj+36slmq2xlvmfxLeIr4m+hjuTPXjgDYjjkwr4UrnLBK98832bBQpYsO97+oMKlag j7xsRb+79SWwQUeJkfcdFLz5i8zzJpkCkUQ33xHcbHitF1gwIMz2mH03qywKiFxO4e7L 7dgiTZ6rXscWptt3HIou1iz1PNUTEp7kdoDJacSKhpLVIoUWrfsdSm/nMTd8OKyfAV7q UWYQ== X-Gm-Message-State: AODbwcB2zzjqkcnvmC4PcPNqQjfmhSWpbP8k1EmPmdZfzeh5/owQUPxV KTv7ZCxC1xyTrBf8 X-Received: by 10.99.166.18 with SMTP id t18mr60683pge.218.1495662056850; Wed, 24 May 2017 14:40:56 -0700 (PDT) Received: from localhost ([2620:0:100e:422:70df:e59:d409:fbba]) by smtp.gmail.com with ESMTPSA id j82sm6471555pfj.69.2017.05.24.14.40.56 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 24 May 2017 14:40:56 -0700 (PDT) From: Stefan Beller To: gitster@pobox.com Cc: git@vger.kernel.org, bmwill@google.com, jrnieder@gmail.com, jonathantanmy@google.com, peff@peff.net, mhagger@alum.mit.edu, Stefan Beller Subject: [PATCHv5 13/17] diff.c: convert diff_flush to use emit_line_* Date: Wed, 24 May 2017 14:40:32 -0700 Message-Id: <20170524214036.29623-14-sbeller@google.com> X-Mailer: git-send-email 2.13.0.18.g7d86cc8ba0 In-Reply-To: <20170524214036.29623-1-sbeller@google.com> References: <20170523024048.16879-1-sbeller@google.com/> <20170524214036.29623-1-sbeller@google.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In a later patch, I want to propose an option to detect&color moved lines in a diff, which cannot be done in a one-pass over the diff. Instead we need to go over the whole diff twice, because we cannot detect the first line of the two corresponding lines (+ and -) that got moved. So to prepare the diff machinery for two pass algorithms (i.e. buffer it all up and then operate on the result), move all emissions to places, such that the only emitting function is emit_line_0. This covers diff_flush. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- diff.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/diff.c b/diff.c index 8317824963..8ebe673331 100644 --- a/diff.c +++ b/diff.c @@ -4872,7 +4872,9 @@ void diff_flush(struct diff_options *options) emit_line(options, NULL, NULL, 1, 0, term, !!term[0]); if (options->stat_sep) { /* attach patch instead of inline */ - fputs(options->stat_sep, options->file); + emit_line(options, NULL, NULL, 0, 0, + options->stat_sep, + strlen(options->stat_sep)); } } -- 2.13.0.18.g7d86cc8ba0