summaryrefslogtreecommitdiff
path: root/community/librewolf/nrappkit-qsort.patch
blob: 6747c21bc36034129087531234b3acfd59033bc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
missing include to use qsort()

--- a/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_local.c	2024-07-09 18:11:39.207125821 +0200
+++ b/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_local.c	2024-07-09 18:12:07.657013364 +0200
@@ -53,6 +53,7 @@
 #include <openssl/ssl.h>
 #endif
 #include <ctype.h>
+#include <stdlib.h>
 #include "registry.h"
 #include "registry_int.h"
 #include "registry_vtbl.h"
@@ -62,6 +63,10 @@
 #include "r_errors.h"
 #include "r_macros.h"
 
+static int nr_compare_string(const void *arg1, const void *arg2) {
+   return strcasecmp(*(const char **)arg1, *(const char **)arg2);
+}
+
 /* if C were an object-oriented language, nr_scalar_registry_node and
  * nr_array_registry_node would subclass nr_registry_node, but it isn't
  * object-oriented language, so this is used in cases where the pointer
@@ -1067,7 +1072,7 @@
     }
 
     assert(sizeof(*arg.children) == sizeof(NR_registry));
-    qsort(arg.children, arg.length, sizeof(*arg.children), (void*)strcasecmp);
+    qsort(arg.children, arg.length, sizeof(*arg.children), nr_compare_string);
 
     *length = arg.length;