diff: rename 'new' variables
Rename C++ keyword in order to bring the codebase closer to being able to be compiled with a C++ compiler. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
e36ede2e1c
commit
63a01c3f79
44
diff.c
44
diff.c
|
@ -1504,7 +1504,7 @@ struct diff_words_style_elem {
|
||||||
|
|
||||||
struct diff_words_style {
|
struct diff_words_style {
|
||||||
enum diff_words_type type;
|
enum diff_words_type type;
|
||||||
struct diff_words_style_elem new, old, ctx;
|
struct diff_words_style_elem new_word, old_word, ctx;
|
||||||
const char *newline;
|
const char *newline;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1655,12 +1655,12 @@ static void fn_out_diff_words_aux(void *priv, char *line, unsigned long len)
|
||||||
}
|
}
|
||||||
if (minus_begin != minus_end) {
|
if (minus_begin != minus_end) {
|
||||||
fn_out_diff_words_write_helper(diff_words->opt,
|
fn_out_diff_words_write_helper(diff_words->opt,
|
||||||
&style->old, style->newline,
|
&style->old_word, style->newline,
|
||||||
minus_end - minus_begin, minus_begin);
|
minus_end - minus_begin, minus_begin);
|
||||||
}
|
}
|
||||||
if (plus_begin != plus_end) {
|
if (plus_begin != plus_end) {
|
||||||
fn_out_diff_words_write_helper(diff_words->opt,
|
fn_out_diff_words_write_helper(diff_words->opt,
|
||||||
&style->new, style->newline,
|
&style->new_word, style->newline,
|
||||||
plus_end - plus_begin, plus_begin);
|
plus_end - plus_begin, plus_begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1758,7 +1758,7 @@ static void diff_words_show(struct diff_words_data *diff_words)
|
||||||
emit_diff_symbol(diff_words->opt, DIFF_SYMBOL_WORD_DIFF,
|
emit_diff_symbol(diff_words->opt, DIFF_SYMBOL_WORD_DIFF,
|
||||||
line_prefix, strlen(line_prefix), 0);
|
line_prefix, strlen(line_prefix), 0);
|
||||||
fn_out_diff_words_write_helper(diff_words->opt,
|
fn_out_diff_words_write_helper(diff_words->opt,
|
||||||
&style->old, style->newline,
|
&style->old_word, style->newline,
|
||||||
diff_words->minus.text.size,
|
diff_words->minus.text.size,
|
||||||
diff_words->minus.text.ptr);
|
diff_words->minus.text.ptr);
|
||||||
diff_words->minus.text.size = 0;
|
diff_words->minus.text.size = 0;
|
||||||
|
@ -1883,8 +1883,8 @@ static void init_diff_words_data(struct emit_callback *ecbdata,
|
||||||
}
|
}
|
||||||
if (want_color(o->use_color)) {
|
if (want_color(o->use_color)) {
|
||||||
struct diff_words_style *st = ecbdata->diff_words->style;
|
struct diff_words_style *st = ecbdata->diff_words->style;
|
||||||
st->old.color = diff_get_color_opt(o, DIFF_FILE_OLD);
|
st->old_word.color = diff_get_color_opt(o, DIFF_FILE_OLD);
|
||||||
st->new.color = diff_get_color_opt(o, DIFF_FILE_NEW);
|
st->new_word.color = diff_get_color_opt(o, DIFF_FILE_NEW);
|
||||||
st->ctx.color = diff_get_color_opt(o, DIFF_CONTEXT);
|
st->ctx.color = diff_get_color_opt(o, DIFF_CONTEXT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2047,8 +2047,8 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
|
||||||
|
|
||||||
static char *pprint_rename(const char *a, const char *b)
|
static char *pprint_rename(const char *a, const char *b)
|
||||||
{
|
{
|
||||||
const char *old = a;
|
const char *old_name = a;
|
||||||
const char *new = b;
|
const char *new_name = b;
|
||||||
struct strbuf name = STRBUF_INIT;
|
struct strbuf name = STRBUF_INIT;
|
||||||
int pfx_length, sfx_length;
|
int pfx_length, sfx_length;
|
||||||
int pfx_adjust_for_slash;
|
int pfx_adjust_for_slash;
|
||||||
|
@ -2067,16 +2067,16 @@ static char *pprint_rename(const char *a, const char *b)
|
||||||
|
|
||||||
/* Find common prefix */
|
/* Find common prefix */
|
||||||
pfx_length = 0;
|
pfx_length = 0;
|
||||||
while (*old && *new && *old == *new) {
|
while (*old_name && *new_name && *old_name == *new_name) {
|
||||||
if (*old == '/')
|
if (*old_name == '/')
|
||||||
pfx_length = old - a + 1;
|
pfx_length = old_name - a + 1;
|
||||||
old++;
|
old_name++;
|
||||||
new++;
|
new_name++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find common suffix */
|
/* Find common suffix */
|
||||||
old = a + len_a;
|
old_name = a + len_a;
|
||||||
new = b + len_b;
|
new_name = b + len_b;
|
||||||
sfx_length = 0;
|
sfx_length = 0;
|
||||||
/*
|
/*
|
||||||
* If there is a common prefix, it must end in a slash. In
|
* If there is a common prefix, it must end in a slash. In
|
||||||
|
@ -2087,13 +2087,13 @@ static char *pprint_rename(const char *a, const char *b)
|
||||||
* underrun the input strings.
|
* underrun the input strings.
|
||||||
*/
|
*/
|
||||||
pfx_adjust_for_slash = (pfx_length ? 1 : 0);
|
pfx_adjust_for_slash = (pfx_length ? 1 : 0);
|
||||||
while (a + pfx_length - pfx_adjust_for_slash <= old &&
|
while (a + pfx_length - pfx_adjust_for_slash <= old_name &&
|
||||||
b + pfx_length - pfx_adjust_for_slash <= new &&
|
b + pfx_length - pfx_adjust_for_slash <= new_name &&
|
||||||
*old == *new) {
|
*old_name == *new_name) {
|
||||||
if (*old == '/')
|
if (*old_name == '/')
|
||||||
sfx_length = len_a - (old - a);
|
sfx_length = len_a - (old_name - a);
|
||||||
old--;
|
old_name--;
|
||||||
new--;
|
new_name--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue