Skip to content

Commit d2543b8

Browse files
tihirvonJunio C Hamano
authored andcommitted
Clean up diff.c
Signed-off-by: Timo Hirvonen <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent acb7014 commit d2543b8

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

diff.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static void emit_rewrite_diff(const char *name_a,
203203
static int fill_mmfile(mmfile_t *mf, struct diff_filespec *one)
204204
{
205205
if (!DIFF_FILE_VALID(one)) {
206-
mf->ptr = ""; /* does not matter */
206+
mf->ptr = (char *)""; /* does not matter */
207207
mf->size = 0;
208208
return 0;
209209
}
@@ -395,7 +395,7 @@ static void show_stats(struct diffstat_t* data)
395395
}
396396

397397
for (i = 0; i < data->nr; i++) {
398-
char *prefix = "";
398+
const char *prefix = "";
399399
char *name = data->files[i]->name;
400400
int added = data->files[i]->added;
401401
int deleted = data->files[i]->deleted;
@@ -917,7 +917,7 @@ int diff_populate_filespec(struct diff_filespec *s, int size_only)
917917
err_empty:
918918
err = -1;
919919
empty:
920-
s->data = "";
920+
s->data = (char *)"";
921921
s->size = 0;
922922
return err;
923923
}
@@ -1408,7 +1408,7 @@ int diff_setup_done(struct diff_options *options)
14081408
return 0;
14091409
}
14101410

1411-
int opt_arg(const char *arg, int arg_short, const char *arg_long, int *val)
1411+
static int opt_arg(const char *arg, int arg_short, const char *arg_long, int *val)
14121412
{
14131413
char c, *eq;
14141414
int len;
@@ -1720,16 +1720,12 @@ static void diff_flush_raw(struct diff_filepair *p,
17201720
free((void*)path_two);
17211721
}
17221722

1723-
static void diff_flush_name(struct diff_filepair *p,
1724-
int inter_name_termination,
1725-
int line_termination)
1723+
static void diff_flush_name(struct diff_filepair *p, int line_termination)
17261724
{
17271725
char *path = p->two->path;
17281726

17291727
if (line_termination)
17301728
path = quote_one(p->two->path);
1731-
else
1732-
path = p->two->path;
17331729
printf("%s%c", path, line_termination);
17341730
if (p->two->path != path)
17351731
free(path);
@@ -1950,9 +1946,7 @@ static void flush_one_pair(struct diff_filepair *p,
19501946
options, diff_output_format);
19511947
break;
19521948
case DIFF_FORMAT_NAME:
1953-
diff_flush_name(p,
1954-
inter_name_termination,
1955-
line_termination);
1949+
diff_flush_name(p, line_termination);
19561950
break;
19571951
case DIFF_FORMAT_NO_OUTPUT:
19581952
break;

0 commit comments

Comments
 (0)