diff options
Diffstat (limited to 'meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch')
-rw-r--r-- | meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch index 30fe9a14df..d856bcb583 100644 --- a/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch +++ b/meta/recipes-core/systemd/systemd/0002-don-t-use-glibc-specific-qsort_r.patch | |||
@@ -1,7 +1,7 @@ | |||
1 | From 3eb12a6ba0bce149717eaabeb1505d379b3d705a Mon Sep 17 00:00:00 2001 | 1 | From 66ece0b870b3a34fdabc48b88437e6cc354e9fce Mon Sep 17 00:00:00 2001 |
2 | From: Chen Qi <Qi.Chen@windriver.com> | 2 | From: Chen Qi <Qi.Chen@windriver.com> |
3 | Date: Mon, 25 Feb 2019 13:41:41 +0800 | 3 | Date: Mon, 25 Feb 2019 13:41:41 +0800 |
4 | Subject: [PATCH] don't use glibc-specific qsort_r | 4 | Subject: [PATCH 02/26] don't use glibc-specific qsort_r |
5 | 5 | ||
6 | Upstream-Status: Inappropriate [musl specific] | 6 | Upstream-Status: Inappropriate [musl specific] |
7 | 7 | ||
@@ -10,18 +10,19 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com> | |||
10 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> | 10 | Signed-off-by: Chen Qi <Qi.Chen@windriver.com> |
11 | [Rebased for v242] | 11 | [Rebased for v242] |
12 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> | 12 | Signed-off-by: Andrej Valek <andrej.valek@siemens.com> |
13 | 13 | [Rebased for v247] | |
14 | Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com> | ||
14 | --- | 15 | --- |
15 | src/basic/sort-util.h | 14 ------------ | 16 | src/basic/sort-util.h | 14 ------------ |
16 | src/libsystemd/sd-hwdb/hwdb-util.c | 19 +++++++++++----- | 17 | src/libsystemd/sd-hwdb/hwdb-util.c | 19 +++++++++++----- |
17 | src/shared/format-table.c | 36 ++++++++++++++++++++---------- | 18 | src/shared/format-table.c | 36 ++++++++++++++++++++---------- |
18 | 3 files changed, 38 insertions(+), 31 deletions(-) | 19 | 3 files changed, 38 insertions(+), 31 deletions(-) |
19 | 20 | ||
20 | Index: systemd-stable/src/basic/sort-util.h | 21 | diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h |
21 | =================================================================== | 22 | index 1d194a1f04..3394c9eb72 100644 |
22 | --- systemd-stable.orig/src/basic/sort-util.h | 23 | --- a/src/basic/sort-util.h |
23 | +++ systemd-stable/src/basic/sort-util.h | 24 | +++ b/src/basic/sort-util.h |
24 | @@ -54,17 +54,3 @@ static inline void _qsort_safe(void *bas | 25 | @@ -54,17 +54,3 @@ static inline void _qsort_safe(void *base, size_t nmemb, size_t size, __compar_f |
25 | int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \ | 26 | int (*_func_)(const typeof(p[0])*, const typeof(p[0])*) = func; \ |
26 | _qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \ | 27 | _qsort_safe((p), (n), sizeof((p)[0]), (__compar_fn_t) _func_); \ |
27 | }) | 28 | }) |
@@ -39,11 +40,11 @@ Index: systemd-stable/src/basic/sort-util.h | |||
39 | - int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \ | 40 | - int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \ |
40 | - qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \ | 41 | - qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \ |
41 | - }) | 42 | - }) |
42 | Index: systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c | 43 | diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c |
43 | =================================================================== | 44 | index 4c94ba9c88..95495dba6d 100644 |
44 | --- systemd-stable.orig/src/libsystemd/sd-hwdb/hwdb-util.c | 45 | --- a/src/libsystemd/sd-hwdb/hwdb-util.c |
45 | +++ systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c | 46 | +++ b/src/libsystemd/sd-hwdb/hwdb-util.c |
46 | @@ -128,9 +128,13 @@ static void trie_free(struct trie *trie) | 47 | @@ -126,9 +126,13 @@ static void trie_free(struct trie *trie) { |
47 | 48 | ||
48 | DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); | 49 | DEFINE_TRIVIAL_CLEANUP_FUNC(struct trie*, trie_free); |
49 | 50 | ||
@@ -60,7 +61,7 @@ Index: systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c | |||
60 | } | 61 | } |
61 | 62 | ||
62 | static int trie_node_add_value(struct trie *trie, struct trie_node *node, | 63 | static int trie_node_add_value(struct trie *trie, struct trie_node *node, |
63 | @@ -158,7 +162,10 @@ static int trie_node_add_value(struct tr | 64 | @@ -156,7 +160,10 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, |
64 | .value_off = v, | 65 | .value_off = v, |
65 | }; | 66 | }; |
66 | 67 | ||
@@ -72,7 +73,7 @@ Index: systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c | |||
72 | if (val) { | 73 | if (val) { |
73 | /* At this point we have 2 identical properties on the same match-string. | 74 | /* At this point we have 2 identical properties on the same match-string. |
74 | * Since we process files in order, we just replace the previous value. */ | 75 | * Since we process files in order, we just replace the previous value. */ |
75 | @@ -184,7 +191,9 @@ static int trie_node_add_value(struct tr | 76 | @@ -182,7 +189,9 @@ static int trie_node_add_value(struct trie *trie, struct trie_node *node, |
76 | .line_number = line_number, | 77 | .line_number = line_number, |
77 | }; | 78 | }; |
78 | node->values_count++; | 79 | node->values_count++; |
@@ -83,11 +84,11 @@ Index: systemd-stable/src/libsystemd/sd-hwdb/hwdb-util.c | |||
83 | return 0; | 84 | return 0; |
84 | } | 85 | } |
85 | 86 | ||
86 | Index: systemd-stable/src/shared/format-table.c | 87 | diff --git a/src/shared/format-table.c b/src/shared/format-table.c |
87 | =================================================================== | 88 | index a13a198b7a..bce10bc607 100644 |
88 | --- systemd-stable.orig/src/shared/format-table.c | 89 | --- a/src/shared/format-table.c |
89 | +++ systemd-stable/src/shared/format-table.c | 90 | +++ b/src/shared/format-table.c |
90 | @@ -1246,31 +1246,33 @@ static int cell_data_compare(TableData * | 91 | @@ -1243,30 +1243,32 @@ static int cell_data_compare(TableData *a, size_t index_a, TableData *b, size_t |
91 | return CMP(index_a, index_b); | 92 | return CMP(index_a, index_b); |
92 | } | 93 | } |
93 | 94 | ||
@@ -95,7 +96,6 @@ Index: systemd-stable/src/shared/format-table.c | |||
95 | +static Table *user_table; | 96 | +static Table *user_table; |
96 | +static int table_data_compare(const void *x, const void *y) { | 97 | +static int table_data_compare(const void *x, const void *y) { |
97 | + const size_t *a = x, *b=y; | 98 | + const size_t *a = x, *b=y; |
98 | size_t i; | ||
99 | int r; | 99 | int r; |
100 | 100 | ||
101 | - assert(t); | 101 | - assert(t); |
@@ -115,8 +115,8 @@ Index: systemd-stable/src/shared/format-table.c | |||
115 | return 1; | 115 | return 1; |
116 | 116 | ||
117 | /* Order other lines by the sorting map */ | 117 | /* Order other lines by the sorting map */ |
118 | - for (i = 0; i < t->n_sort_map; i++) { | 118 | - for (size_t i = 0; i < t->n_sort_map; i++) { |
119 | + for (i = 0; i < user_table->n_sort_map; i++) { | 119 | + for (size_t i = 0; i < user_table->n_sort_map; i++) { |
120 | TableData *d, *dd; | 120 | TableData *d, *dd; |
121 | 121 | ||
122 | - d = t->data[*a + t->sort_map[i]]; | 122 | - d = t->data[*a + t->sort_map[i]]; |
@@ -131,8 +131,8 @@ Index: systemd-stable/src/shared/format-table.c | |||
131 | } | 131 | } |
132 | 132 | ||
133 | /* Order identical lines by the order there were originally added in */ | 133 | /* Order identical lines by the order there were originally added in */ |
134 | @@ -1798,7 +1800,12 @@ int table_print(Table *t, FILE *f) { | 134 | @@ -1844,7 +1846,12 @@ int table_print(Table *t, FILE *f) { |
135 | for (i = 0; i < n_rows; i++) | 135 | for (size_t i = 0; i < n_rows; i++) |
136 | sorted[i] = i * t->n_columns; | 136 | sorted[i] = i * t->n_columns; |
137 | 137 | ||
138 | - typesafe_qsort_r(sorted, n_rows, table_data_compare, t); | 138 | - typesafe_qsort_r(sorted, n_rows, table_data_compare, t); |
@@ -145,8 +145,8 @@ Index: systemd-stable/src/shared/format-table.c | |||
145 | } | 145 | } |
146 | 146 | ||
147 | if (t->display_map) | 147 | if (t->display_map) |
148 | @@ -2375,7 +2382,12 @@ int table_to_json(Table *t, JsonVariant | 148 | @@ -2440,7 +2447,12 @@ int table_to_json(Table *t, JsonVariant **ret) { |
149 | for (i = 0; i < n_rows; i++) | 149 | for (size_t i = 0; i < n_rows; i++) |
150 | sorted[i] = i * t->n_columns; | 150 | sorted[i] = i * t->n_columns; |
151 | 151 | ||
152 | - typesafe_qsort_r(sorted, n_rows, table_data_compare, t); | 152 | - typesafe_qsort_r(sorted, n_rows, table_data_compare, t); |
@@ -159,3 +159,6 @@ Index: systemd-stable/src/shared/format-table.c | |||
159 | } | 159 | } |
160 | 160 | ||
161 | if (t->display_map) | 161 | if (t->display_map) |
162 | -- | ||
163 | 2.27.0 | ||
164 | |||