[vlc-devel] [PATCH 3/7] posix: implement vlc_qsort with POSIX qsort_r

Thomas Guillem thomas at gllm.fr
Mon Jan 21 17:43:03 CET 2019


---
 src/Makefile.am   |  3 ++-
 src/posix/utils.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 src/posix/utils.c

diff --git a/src/Makefile.am b/src/Makefile.am
index a98f5fdac1..7ab5703254 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -466,7 +466,8 @@ libvlccore_la_SOURCES += \
 	posix/netconf.c \
 	posix/picture.c \
 	posix/specific.c \
-	posix/thread.c
+	posix/thread.c \
+	posix/utils.c
 if HAVE_LINUX
 libvlccore_la_SOURCES += \
 	linux/cpu.c \
diff --git a/src/posix/utils.c b/src/posix/utils.c
new file mode 100644
index 0000000000..3ad6120f6c
--- /dev/null
+++ b/src/posix/utils.c
@@ -0,0 +1,33 @@
+/******************************************************************************
+ * utils.c: POSIX utils back-end
+ ******************************************************************************
+ * Copyright © 2019 VLC authors and VideoLAN
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <vlc_common.h>
+#include <vlc_utils.h>
+
+void vlc_qsort(void *base, size_t nmemb, size_t size,
+               int (*compar)(const void *, const void *, void *),
+               void *arg)
+{
+    qsort_r(base, nmemb, size, compar, arg);
+}
-- 
2.20.1



More information about the vlc-devel mailing list