aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-core/sdbus-c++/sdbus-c++-libsystemd-243/0003-missing_type.h-add-__compare_fn_t-and-comparison_fn_.patch
blob: 2e39f7a2e19b5e4163391b7da4d51126acab0d2e (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From a9421d55102fc84f77f7c21a2479fcd00652b896 Mon Sep 17 00:00:00 2001
From: Chen Qi <Qi.Chen@windriver.com>
Date: Mon, 25 Feb 2019 13:55:12 +0800
Subject: [PATCH 03/24] missing_type.h: add __compare_fn_t and comparison_fn_t

Make it work with musl where comparison_fn_t and __compare_fn_t
is not provided.

Upstream-Status: Inappropriate [musl specific]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
[Rebased for v242]
Signed-off-by: Andrej Valek <andrej.valek@siemens.com>
---
 src/basic/missing_type.h | 9 +++++++++
 src/basic/sort-util.h    | 1 +
 src/journal/catalog.c    | 1 +
 3 files changed, 11 insertions(+)

diff --git a/src/basic/missing_type.h b/src/basic/missing_type.h
index bf8a6caa1b..2134fe5095 100644
--- a/src/basic/missing_type.h
+++ b/src/basic/missing_type.h
@@ -10,3 +10,12 @@
 #if !HAVE_CHAR16_T
 #define char16_t uint16_t
 #endif
+
+#ifndef __GLIBC__
+typedef int (*comparison_fn_t)(const void *, const void *);
+#endif
+
+#ifndef __COMPAR_FN_T
+#define __COMPAR_FN_T
+typedef int (*__compar_fn_t)(const void *, const void *);
+#endif
diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h
index e029f86..7247d40 100644
--- a/src/basic/sort-util.h
+++ b/src/basic/sort-util.h
@@ -4,6 +4,7 @@
 #include <stdlib.h>
 
 #include "macro.h"
+#include "missing.h"
 
 void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
                  __compar_d_fn_t compar, void *arg);
diff --git a/src/journal/catalog.c b/src/journal/catalog.c
index 7beffc1e1a..4818a2e5cc 100644
--- a/src/journal/catalog.c
+++ b/src/journal/catalog.c
@@ -29,6 +29,7 @@
 #include "string-util.h"
 #include "strv.h"
 #include "tmpfile-util.h"
+#include "missing.h"
 
 const char * const catalog_file_dirs[] = {
         "/usr/local/lib/systemd/catalog/",
-- 
2.11.0