aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2021-09-19 22:17:21 +0200
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2021-09-19 22:24:03 +0200
commit453e83d1cf862c27a468a50e6f3cea7f803bc501 (patch)
tree192c7ccf7438b036834306d2c2f9e4099001c61d
parentcd735a144ccac75282179af8dad056b5e5c0a83d (diff)
downloaddns-453e83d1cf862c27a468a50e6f3cea7f803bc501.tar.gz
tests/tree.c: fix compiler warnings
-rw-r--r--tests/tree.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/tree.c b/tests/tree.c
index 42bf248..ccfb3fe 100644
--- a/tests/tree.c
+++ b/tests/tree.c
@@ -15,16 +15,19 @@ START_TEST(tree_basic) {
unsigned const int len = pow ( 'z' - 'a' + 1, 2);
unsigned int len_cnt = 0;
- char* keys[len];
- char* data[len];
+ char** keys;
+ char** data;
struct tree_node* root = NULL;
+ keys = malloc(len * sizeof(char*));
+ data = malloc(len * sizeof(char*));
+
for ( i = 'a'; i <= 'z'; i++ ) {
for ( j = 'a'; j <= 'z'; j++ ) {
keys[len_cnt] = malloc (3);
- keys[len_cnt][0] = i;
- keys[len_cnt][1] = j;
+ keys[len_cnt][0] = (char)i;
+ keys[len_cnt][1] = (char)j;
keys[len_cnt][2] = 0;
data[len_cnt] = malloc(10);
@@ -41,6 +44,9 @@ START_TEST(tree_basic) {
}
ck_assert_int_eq( tree_destroy (&root, _TREE_FREE_DATA | _TREE_FREE_KEY), 0 );
+
+ free(keys);
+ free(data);
} END_TEST
TCase* test_tree(void) {