@@ -897,13 +897,13 @@ static void print_line(const char *prefix, char first,
897
897
fputs ("\\ No newline at end of file\n" , file );
898
898
}
899
899
900
- static char * output_prefix (struct diff_options * opt )
900
+ static const char * output_prefix (struct diff_options * opt )
901
901
{
902
902
if (opt -> output_prefix ) {
903
903
struct strbuf * sb = opt -> output_prefix (opt , opt -> output_prefix_data );
904
904
return sb -> buf ;
905
905
} else {
906
- return xstrdup ( "" ) ;
906
+ return "" ;
907
907
}
908
908
}
909
909
@@ -916,7 +916,7 @@ static void dump_diff_hacky_one(struct rev_info *rev, struct line_log_data *rang
916
916
struct diff_ranges * diff = & range -> diff ;
917
917
918
918
struct diff_options * opt = & rev -> diffopt ;
919
- char * prefix = output_prefix (opt );
919
+ const char * prefix = output_prefix (opt );
920
920
const char * c_reset = diff_get_color (opt -> use_color , DIFF_RESET );
921
921
const char * c_frag = diff_get_color (opt -> use_color , DIFF_FRAGINFO );
922
922
const char * c_meta = diff_get_color (opt -> use_color , DIFF_METAINFO );
@@ -1003,7 +1003,6 @@ static void dump_diff_hacky_one(struct rev_info *rev, struct line_log_data *rang
1003
1003
out :
1004
1004
free (p_ends );
1005
1005
free (t_ends );
1006
- free (prefix );
1007
1006
}
1008
1007
1009
1008
/*
@@ -1012,10 +1011,9 @@ static void dump_diff_hacky_one(struct rev_info *rev, struct line_log_data *rang
1012
1011
*/
1013
1012
static void dump_diff_hacky (struct rev_info * rev , struct line_log_data * range )
1014
1013
{
1015
- char * prefix = output_prefix (& rev -> diffopt );
1014
+ const char * prefix = output_prefix (& rev -> diffopt );
1016
1015
1017
1016
fprintf (rev -> diffopt .file , "%s\n" , prefix );
1018
- free (prefix );
1019
1017
1020
1018
while (range ) {
1021
1019
dump_diff_hacky_one (rev , range );
0 commit comments