From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 6/7] diff.c: add new arguments to emit_line_0()
Date: Thu, 31 Dec 2015 19:37:36 +0700 [thread overview]
Message-ID: <1451565457-18756-7-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1451565457-18756-1-git-send-email-pclouds@gmail.com>
This patch is no-op, to reduce noise in the next one.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
diff.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
diff --git a/diff.c b/diff.c
index 3b7317e..47d22e3 100644
--- a/diff.c
+++ b/diff.c
@@ -458,7 +458,9 @@ struct tagged_pointer {
};
static void emit_line_0(struct diff_options *o, const char *set, const char *reset,
- int first, const char *line, int len)
+ int first, const char *line, int len,
+ struct tagged_pointer *begin,
+ struct tagged_pointer *end)
{
int has_trailing_newline, has_trailing_carriage_return;
int nofirst;
@@ -497,7 +499,7 @@ static void emit_line_0(struct diff_options *o, const char *set, const char *res
static void emit_line(struct diff_options *o, const char *set, const char *reset,
const char *line, int len)
{
- emit_line_0(o, set, reset, line[0], line+1, len-1);
+ emit_line_0(o, set, reset, line[0], line+1, len-1, NULL, NULL);
}
static int new_blank_line_at_eof(struct emit_callback *ecbdata, const char *line, int len)
@@ -516,7 +518,9 @@ static void emit_line_checked(const char *reset,
const char *line, int len,
enum color_diff color,
unsigned ws_error_highlight,
- char sign)
+ char sign,
+ struct tagged_pointer *begin,
+ struct tagged_pointer *end)
{
const char *set = diff_get_color(ecbdata->color_diff, color);
const char *ws = NULL;
@@ -528,13 +532,16 @@ static void emit_line_checked(const char *reset,
}
if (!ws)
- emit_line_0(ecbdata->opt, set, reset, sign, line, len);
+ emit_line_0(ecbdata->opt, set, reset, sign,
+ line, len, begin, end);
else if (sign == '+' && new_blank_line_at_eof(ecbdata, line, len))
/* Blank line at EOF - paint '+' as well */
- emit_line_0(ecbdata->opt, ws, reset, sign, line, len);
+ emit_line_0(ecbdata->opt, ws, reset, sign,
+ line, len, begin, end);
else {
/* Emit just the prefix, then the rest. */
- emit_line_0(ecbdata->opt, set, reset, sign, "", 0);
+ emit_line_0(ecbdata->opt, set, reset, sign,
+ "", 0, NULL, NULL);
ws_check_emit(line, len, ecbdata->ws_rule,
ecbdata->opt->file, set, reset, ws);
}
@@ -545,7 +552,8 @@ static void emit_add_line(const char *reset,
const char *line, int len)
{
emit_line_checked(reset, ecbdata, line, len,
- DIFF_FILE_NEW, WSEH_NEW, '+');
+ DIFF_FILE_NEW, WSEH_NEW, '+',
+ NULL, NULL);
}
static void emit_del_line(const char *reset,
@@ -553,7 +561,8 @@ static void emit_del_line(const char *reset,
const char *line, int len)
{
emit_line_checked(reset, ecbdata, line, len,
- DIFF_FILE_OLD, WSEH_OLD, '-');
+ DIFF_FILE_OLD, WSEH_OLD, '-',
+ NULL, NULL);
}
static void emit_context_line(const char *reset,
@@ -561,7 +570,8 @@ static void emit_context_line(const char *reset,
const char *line, int len)
{
emit_line_checked(reset, ecbdata, line, len,
- DIFF_CONTEXT, WSEH_CONTEXT, ' ');
+ DIFF_CONTEXT, WSEH_CONTEXT, ' ',
+ NULL, NULL);
}
static void emit_hunk_header(struct emit_callback *ecbdata,
@@ -682,7 +692,7 @@ static void emit_rewrite_lines(struct emit_callback *ecb,
DIFF_CONTEXT);
putc('\n', ecb->opt->file);
emit_line_0(ecb->opt, context, reset, '\\',
- nneof, strlen(nneof));
+ nneof, strlen(nneof), NULL, NULL);
}
}
@@ -1301,7 +1311,8 @@ static void diff_words_flush_unified(struct emit_callback *ecb,
assert(end_line->tag == TAG_END_LINE);
emit_line_checked(reset, ecb, begin_line->str,
end_line->str - begin_line->str,
- color, ws_error_highlight, sign);
+ color, ws_error_highlight, sign,
+ NULL, NULL);
}
b->mark_nr = 0;
}
--
2.3.0.rc1.137.g477eb31
next prev parent reply other threads:[~2015-12-31 12:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-31 12:37 A failed attempt to integrate diff-highlight to the core Nguyễn Thái Ngọc Duy
2015-12-31 12:37 ` [PATCH 1/7] diff.c: keep all word diff structs together Nguyễn Thái Ngọc Duy
2015-12-31 12:37 ` [PATCH 2/7] diff.c: refactor diff_words_append() Nguyễn Thái Ngọc Duy
2015-12-31 12:37 ` [PATCH 3/7] diff --color-words: another special diff case Nguyễn Thái Ngọc Duy
2015-12-31 12:37 ` [PATCH 4/7] diff.c: refactor fn_out_diff_words_write_helper() Nguyễn Thái Ngọc Duy
2015-12-31 12:37 ` [PATCH 5/7] diff: unified diff with colored words, step 1, unified diff only Nguyễn Thái Ngọc Duy
2015-12-31 12:37 ` Nguyễn Thái Ngọc Duy [this message]
2015-12-31 12:37 ` [PATCH 7/7] diff --highlight-words: actually highlight words Nguyễn Thái Ngọc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1451565457-18756-7-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).