summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2016-09-29 15:27:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-29 22:42:18 (GMT)
commit9ed0d8d6e6de7737fe9a658446318b86e57c6fad (patch)
tree82fdefc7bd543c99091f5b634947360f75100deb /diff.c
parentdbc540c7a5827529a3f58befc9e5b81a31ec8fab (diff)
downloadgit-9ed0d8d6e6de7737fe9a658446318b86e57c6fad.zip
git-9ed0d8d6e6de7737fe9a658446318b86e57c6fad.tar.gz
git-9ed0d8d6e6de7737fe9a658446318b86e57c6fad.tar.bz2
use QSORT
Apply the semantic patch contrib/coccinelle/qsort.cocci to the code base, replacing calls of qsort(3) with QSORT. The resulting code is shorter and supports empty arrays with NULL pointers. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/diff.c b/diff.c
index a178ed3..c2f09fb 100644
--- a/diff.c
+++ b/diff.c
@@ -2019,7 +2019,7 @@ found_damage:
return;
/* Show all directories with more than x% of the changes */
- qsort(dir.files, dir.nr, sizeof(dir.files[0]), dirstat_compare);
+ QSORT(dir.files, dir.nr, dirstat_compare);
gather_dirstat(options, &dir, changed, "", 0);
}
@@ -2063,7 +2063,7 @@ static void show_dirstat_by_line(struct diffstat_t *data, struct diff_options *o
return;
/* Show all directories with more than x% of the changes */
- qsort(dir.files, dir.nr, sizeof(dir.files[0]), dirstat_compare);
+ QSORT(dir.files, dir.nr, dirstat_compare);
gather_dirstat(options, &dir, changed, "", 0);
}
@@ -4923,7 +4923,7 @@ static int diffnamecmp(const void *a_, const void *b_)
void diffcore_fix_diff_index(struct diff_options *options)
{
struct diff_queue_struct *q = &diff_queued_diff;
- qsort(q->queue, q->nr, sizeof(q->queue[0]), diffnamecmp);
+ QSORT(q->queue, q->nr, diffnamecmp);
}
void diffcore_std(struct diff_options *options)