ref: refs/heads/master
commit 0457626762d9863feab073b0d37d7c1e57b79af8
Author: Michael Schroeder
Date: Tue May 12 12:18:55 2009 +0200
- add sat_sort() function
---
src/util.c | 9 +++++++++
src/util.h | 1 +
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/util.c b/src/util.c
index 915dd1b..d534ba9 100644
--- a/src/util.c
+++ b/src/util.c
@@ -5,6 +5,8 @@
* for further information
*/
+#define _GNU_SOURCE
+
#include
#include
#include
@@ -96,3 +98,10 @@ sat_timems(unsigned int subtract)
return r - subtract;
}
+/* bsd's qsort_r has different arguments, so we define our
+ own version in case we need to do some clever mapping */
+void
+sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard)
+{
+ qsort_r(base, nmemb, size, compar, compard);
+}
diff --git a/src/util.h b/src/util.h
index 7662b62..e578faf 100644
--- a/src/util.h
+++ b/src/util.h
@@ -28,6 +28,7 @@ extern void *sat_realloc2(void *, size_t, size_t);
extern void *sat_free(void *);
extern void sat_oom(size_t, size_t);
extern unsigned int sat_timems(unsigned int subtract);
+extern void sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard);
static inline void *sat_extend(void *buf, size_t len, size_t nmemb, size_t size, size_t block)
{
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org