aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-03-02 12:51:26 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-03-02 12:51:26 +0000
commitfb29038b59fa639b79de99c4edddfa6462918765 (patch)
treea527be76248ef6d10a5861a2e423d6f049b9d51a /libbb
parent509697f00df5286674fdbdf7b02a57fea83636d0 (diff)
downloadbusybox-fb29038b59fa639b79de99c4edddfa6462918765.tar.gz
libbb: inntroduce and use bb_pstrcmp() and qsort_string_vector()
msh: glob0/glob1/glob2/glob3 are just a sorting routine! remove them. bb_pstrcmp - 25 +25 qsort_string_vector - 24 +24 expand 2209 2227 +18 getopt32 1359 1370 +11 passwd_main 1072 1074 +2 handle_incoming_and_exit 2737 2735 -2 UNSPEC_print 66 64 -2 forkexec 1343 1339 -4 input_tab 3338 3330 -8 get_dir 185 177 -8 expmeta 481 473 -8 cmdputs 405 397 -8 xstrcmp 12 - -12 find_pair 187 167 -20 match_compare 25 - -25 dir_strcmp 25 - -25 glob2 27 - -27 glob3 34 - -34 glob1 256 - -256 ------------------------------------------------------------------------------ (add/remove: 2/6 grow/shrink: 3/8 up/down: 80/-439) Total: -359 bytes
Diffstat (limited to 'libbb')
-rw-r--r--libbb/Kbuild1
-rw-r--r--libbb/lineedit.c7
2 files changed, 2 insertions, 6 deletions
diff --git a/libbb/Kbuild b/libbb/Kbuild
index fd366559a..654722cd6 100644
--- a/libbb/Kbuild
+++ b/libbb/Kbuild
@@ -12,6 +12,7 @@ lib-y += bb_askpass.o
lib-y += bb_basename.o
lib-y += bb_do_delay.o
lib-y += bb_pwd.o
+lib-y += bb_qsort.o
lib-y += bb_strtonum.o
lib-y += change_identity.o
lib-y += chomp.o
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index d716169d4..7e408207c 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -796,11 +796,6 @@ static char *add_quote_for_spec_chars(char *found)
return s;
}
-static int match_compare(const void *a, const void *b)
-{
- return strcmp(*(char**)a, *(char**)b);
-}
-
/* Do TAB completion */
static void input_tab(smallint *lastWasTab)
{
@@ -841,7 +836,7 @@ static void input_tab(smallint *lastWasTab)
/* Sort, then remove any duplicates found */
if (matches) {
int i, n = 0;
- qsort(matches, num_matches, sizeof(char*), match_compare);
+ qsort_string_vector(matches, num_matches);
for (i = 0; i < num_matches - 1; ++i) {
if (matches[i] && matches[i+1]) { /* paranoia */
if (strcmp(matches[i], matches[i+1]) == 0) {