From: Bo Yang <struggleyb.nku@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, trast@student.ethz.ch
Subject: [PATCH 2/7] Change to call the new emit_line.
Date: Sat, 15 May 2010 04:02:06 -0700 [thread overview]
Message-ID: <1273921331-32702-3-git-send-email-struggleyb.nku@gmail.com> (raw)
In-Reply-To: <1273921331-32702-2-git-send-email-struggleyb.nku@gmail.com>
Call the new emit_line function.
Signed-off-by: Bo Yang <struggleyb.nku@gmail.com>
---
diff.c | 34 +++++++++++++++++-----------------
1 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/diff.c b/diff.c
index 2a38bef..9bd9063 100644
--- a/diff.c
+++ b/diff.c
@@ -194,8 +194,8 @@ struct emit_callback {
sane_truncate_fn truncate;
const char **label_path;
struct diff_words_data *diff_words;
+ struct diff_options *opt;
int *found_changesp;
- FILE *file;
struct strbuf *header;
};
@@ -346,15 +346,15 @@ static void emit_add_line(const char *reset,
const char *set = diff_get_color(ecbdata->color_diff, DIFF_FILE_NEW);
if (!*ws)
- emit_line_0(ecbdata->file, set, reset, '+', line, len);
+ emit_line_0(ecbdata->opt, set, reset, '+', line, len);
else if (new_blank_line_at_eof(ecbdata, line, len))
/* Blank line at EOF - paint '+' as well */
- emit_line_0(ecbdata->file, ws, reset, '+', line, len);
+ emit_line_0(ecbdata->opt, ws, reset, '+', line, len);
else {
/* Emit just the prefix, then the rest. */
- emit_line_0(ecbdata->file, set, reset, '+', "", 0);
+ emit_line_0(ecbdata->opt, set, reset, '+', "", 0);
ws_check_emit(line, len, ecbdata->ws_rule,
- ecbdata->file, set, reset, ws);
+ ecbdata->opt->file, set, reset, ws);
}
}
@@ -375,23 +375,23 @@ static void emit_hunk_header(struct emit_callback *ecbdata,
if (len < 10 ||
memcmp(line, atat, 2) ||
!(ep = memmem(line + 2, len - 2, atat, 2))) {
- emit_line(ecbdata->file, plain, reset, line, len);
+ emit_line(ecbdata->opt, plain, reset, line, len);
return;
}
ep += 2; /* skip over @@ */
/* The hunk header in fraginfo color */
- emit_line(ecbdata->file, frag, reset, line, ep - line);
+ emit_line(ecbdata->opt, frag, reset, line, ep - line);
/* blank before the func header */
for (cp = ep; ep - line < len; ep++)
if (*ep != ' ' && *ep != '\t')
break;
if (ep != cp)
- emit_line(ecbdata->file, plain, reset, cp, ep - cp);
+ emit_line(ecbdata->opt, plain, reset, cp, ep - cp);
if (ep < line + len)
- emit_line(ecbdata->file, func, reset, ep, line + len - ep);
+ emit_line(ecbdata->opt, func, reset, ep, line + len - ep);
}
static struct diff_tempfile *claim_diff_tempfile(void) {
@@ -451,7 +451,7 @@ static void emit_rewrite_lines(struct emit_callback *ecb,
len = endp ? (endp - data + 1) : size;
if (prefix != '+') {
ecb->lno_in_preimage++;
- emit_line_0(ecb->file, old, reset, '-',
+ emit_line_0(ecb->opt, old, reset, '-',
data, len);
} else {
ecb->lno_in_postimage++;
@@ -463,7 +463,7 @@ static void emit_rewrite_lines(struct emit_callback *ecb,
if (!endp) {
const char *plain = diff_get_color(ecb->color_diff,
DIFF_PLAIN);
- emit_line_0(ecb->file, plain, reset, '\\',
+ emit_line_0(ecb->opt, plain, reset, '\\',
nneof, strlen(nneof));
}
}
@@ -513,7 +513,7 @@ static void emit_rewrite_diff(const char *name_a,
ecbdata.color_diff = color_diff;
ecbdata.found_changesp = &o->found_changes;
ecbdata.ws_rule = whitespace_rule(name_b ? name_b : name_a);
- ecbdata.file = o->file;
+ ecbdata.opt = o;
if (ecbdata.ws_rule & WS_BLANK_AT_EOF) {
mmfile_t mf1, mf2;
mf1.ptr = (char *)data_one;
@@ -828,7 +828,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
}
if (len < 1) {
- emit_line(ecbdata->file, reset, reset, line, len);
+ emit_line(ecbdata->opt, reset, reset, line, len);
return;
}
@@ -845,7 +845,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
diff_words_flush(ecbdata);
line++;
len--;
- emit_line(ecbdata->file, plain, reset, line, len);
+ emit_line(ecbdata->opt, plain, reset, line, len);
return;
}
@@ -856,7 +856,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
ecbdata->lno_in_preimage++;
if (line[0] == ' ')
ecbdata->lno_in_postimage++;
- emit_line(ecbdata->file, color, reset, line, len);
+ emit_line(ecbdata->opt, color, reset, line, len);
} else {
ecbdata->lno_in_postimage++;
emit_add_line(reset, ecbdata, line + 1, len - 1);
@@ -1421,7 +1421,7 @@ static void checkdiff_consume(void *priv, char *line, unsigned long len)
fprintf(data->o->file, "%s:%d: %s.\n",
data->filename, data->lineno, err);
free(err);
- emit_line(data->o->file, set, reset, line, 1);
+ emit_line(data->o, set, reset, line, 1);
ws_check_emit(line + 1, len - 1, data->ws_rule,
data->o->file, set, reset, ws);
} else if (line[0] == ' ') {
@@ -1731,7 +1731,7 @@ static void builtin_diff(const char *name_a,
ecbdata.ws_rule = whitespace_rule(name_b ? name_b : name_a);
if (ecbdata.ws_rule & WS_BLANK_AT_EOF)
check_blank_at_eof(&mf1, &mf2, &ecbdata);
- ecbdata.file = o->file;
+ ecbdata.opt = o;
ecbdata.header = header.len ? &header : NULL;
xpp.flags = XDF_NEED_MINIMAL | o->xdl_opts;
xecfg.ctxlen = o->context;
--
1.7.1.94.gc3269
next prev parent reply other threads:[~2010-05-15 11:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-15 11:02 [PATCH 0/7] Make git log --graph looks better with -p and other diff options Bo Yang
2010-05-15 11:02 ` [PATCH 1/7] Add a prefix output callback to diff output Bo Yang
2010-05-15 11:02 ` Bo Yang [this message]
2010-05-15 11:02 ` [PATCH 3/7] Output the graph columns at the end of the commit message Bo Yang
2010-05-15 11:02 ` [PATCH 4/7] diff.c: Output the text graph padding before each diff line Bo Yang
2010-05-15 11:02 ` [PATCH 5/7] Emit a whole line once a time Bo Yang
2010-05-15 11:02 ` [PATCH 6/7] Register a callback for graph output Bo Yang
2010-05-15 11:02 ` [PATCH 7/7] Make --color-words work well with --graph Bo Yang
2010-05-17 6:59 ` Thomas Rast
2010-05-17 6:57 ` [PATCH 6/7] Register a callback for graph output Thomas Rast
2010-05-17 6:52 ` [PATCH 4/7] diff.c: Output the text graph padding before each diff line Thomas Rast
2010-05-17 6:45 ` [PATCH 2/7] Change to call the new emit_line Thomas Rast
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=1273921331-32702-3-git-send-email-struggleyb.nku@gmail.com \
--to=struggleyb.nku@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=trast@student.ethz.ch \
/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).