aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/basetypes/MCArray.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/basetypes/MCArray.cc')
-rw-r--r--src/core/basetypes/MCArray.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/core/basetypes/MCArray.cc b/src/core/basetypes/MCArray.cc
index 804f796c..038ec022 100644
--- a/src/core/basetypes/MCArray.cc
+++ b/src/core/basetypes/MCArray.cc
@@ -229,6 +229,23 @@ Array * Array::sortedArray(int (* compare)(void * a, void * b, void * context),
return result;
}
+void Array::sortArray(int (* compare)(void * a, void * b, void * context), void * context)
+{
+ struct sortData data;
+ data.compare = compare;
+ data.context = context;
+#ifdef __MACH__
+ qsort_r(carray_data(mArray), carray_count(mArray),
+ sizeof(* carray_data(mArray)), &data,
+ (int (*)(void *, const void *, const void *)) sortCompare);
+#else
+ qsort_r(carray_data(mArray), carray_count(mArray),
+ sizeof(* carray_data(mArray)),
+ (int (*)(const void *, const void *, void *)) sortCompare,
+ &data);
+#endif
+}
+
String * Array::componentsJoinedByString(String * delimiter)
{
String * result = String::string();