Jan Engelhardt
bd0416e417
OBS-URL: https://build.opensuse.org/package/show/Base:System/kmod?expand=0&rev=92
43 lines
1.3 KiB
Diff
43 lines
1.3 KiB
Diff
From 813357548c7f9063996783e2ac8382501e32a4ed Mon Sep 17 00:00:00 2001
|
|
From: Marcus Meissner <meissner@suse.de>
|
|
Date: Fri, 6 Mar 2015 08:57:10 +0100
|
|
Subject: [PATCH] use correct sort method in test-array
|
|
Status: mailed to upstream
|
|
|
|
the pointers we get are char ** not char *
|
|
---
|
|
testsuite/test-array.c | 10 +++++++++-
|
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/testsuite/test-array.c b/testsuite/test-array.c
|
|
index 3c72a8a..8e1b2ba 100644
|
|
--- a/testsuite/test-array.c
|
|
+++ b/testsuite/test-array.c
|
|
@@ -90,6 +90,14 @@ static int test_array_append_unique(const struct test *t)
|
|
DEFINE_TEST(test_array_append_unique,
|
|
.description = "test array append unique");
|
|
|
|
+static int array_strcmp(void *a, void *b)
|
|
+{
|
|
+ char *pa = *(char **)a;
|
|
+ char *pb = *(char **)b;
|
|
+
|
|
+ return strcmp(pa, pb);
|
|
+}
|
|
+
|
|
static int test_array_sort(const struct test *t)
|
|
{
|
|
struct array array;
|
|
@@ -104,7 +112,7 @@ static int test_array_sort(const struct test *t)
|
|
array_append(&array, c2);
|
|
array_append(&array, c3);
|
|
array_append(&array, c1);
|
|
- array_sort(&array, (int (*)(const void *a, const void *b)) strcmp);
|
|
+ array_sort(&array, (int (*)(const void *a, const void *b)) array_strcmp);
|
|
assert_return(array.count == 6, EXIT_FAILURE);
|
|
assert_return(array.array[0] == c1, EXIT_FAILURE);
|
|
assert_return(array.array[1] == c1, EXIT_FAILURE);
|
|
--
|
|
2.1.4
|
|
|