summaryrefslogtreecommitdiff
path: root/tree.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 /tree.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 'tree.c')
-rw-r--r--tree.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tree.c b/tree.c
index 2b5a5a8..ce345c5 100644
--- a/tree.c
+++ b/tree.c
@@ -180,8 +180,7 @@ int read_tree(struct tree *tree, int stage, struct pathspec *match)
* Sort the cache entry -- we need to nuke the cache tree, though.
*/
cache_tree_free(&active_cache_tree);
- qsort(active_cache, active_nr, sizeof(active_cache[0]),
- cmp_cache_name_compare);
+ QSORT(active_cache, active_nr, cmp_cache_name_compare);
return 0;
}