aboutsummaryrefslogtreecommitdiff
path: root/libbb/bb_qsort.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/bb_qsort.c')
-rw-r--r--libbb/bb_qsort.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libbb/bb_qsort.c b/libbb/bb_qsort.c
new file mode 100644
index 0000000..9773afa
--- /dev/null
+++ b/libbb/bb_qsort.c
@@ -0,0 +1,20 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * Wrapper for common string vector sorting operation
+ *
+ * Copyright (c) 2008 Denys Vlasenko
+ *
+ * Licensed under GPLv2, see file LICENSE in this tarball for details.
+ */
+
+#include "libbb.h"
+
+int /* not FAST_FUNC! */ bb_pstrcmp(const void *a, const void *b)
+{
+ return strcmp(*(char**)a, *(char**)b);
+}
+
+void FAST_FUNC qsort_string_vector(char **sv, unsigned count)
+{
+ qsort(sv, count, sizeof(char*), bb_pstrcmp);
+}