Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=fvbe.git;a=commitdiff;h=3661cb7ed167e7954473536407d2b8e44ace1831
commit 3661cb7ed167e7954473536407d2b8e44ace1831 Author: James Buren <[email protected]> Date: Sat Sep 21 21:09:51 2013 -0500 format/utility: replace sorting logic with simpler subtraction. same logic as old expression but more compact. diff --git a/src/format.c b/src/format.c index dff06ab..6a15866 100644 --- a/src/format.c +++ b/src/format.c @@ -54,7 +54,7 @@ static int compare_target(const void *A,const void *B) size_t c = dirs_count(a->mountpath); size_t d = dirs_count(b->mountpath); - return (c < d) ? -1 : (c > d) ? 1 : 0; + return c - d; } static inline void probe_filesystem(struct format *target) diff --git a/src/utility.c b/src/utility.c index 21a1503..de7c833 100644 --- a/src/utility.c +++ b/src/utility.c @@ -17,6 +17,7 @@ #include "local.h" +#if 0 static int dirs_ascend_compare(const void *A,const void *B) { const char *a = * (char **) A; @@ -24,8 +25,9 @@ static int dirs_ascend_compare(const void *A,const void *B) size_t c = dirs_count(a); size_t d = dirs_count(b); - return (c < d) ? -1 : (c > d) ? 1 : 0; + return c - d; } +#endif static int dirs_descend_compare(const void *A,const void *B) { @@ -34,7 +36,7 @@ static int dirs_descend_compare(const void *A,const void *B) size_t c = dirs_count(a); size_t d = dirs_count(b); - return (c < d) ? 1 : (c > d) ? -1 : 0; + return d - c; } static int raid_compare(const void *A,const void *B) _______________________________________________ Frugalware-git mailing list [email protected] http://frugalware.org/mailman/listinfo/frugalware-git
