]> sourceware.org Git - lvm2.git/commitdiff
Cleanup test compile warning
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 13 Dec 2011 12:08:42 +0000 (12:08 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 13 Dec 2011 12:08:42 +0000 (12:08 +0000)
Add some declaration and cast to cleanup gcc warnings.
Add missing dm_config_destroy() to cleanup pool leak report.

test/unit/bitset_t.c
test/unit/config_t.c
test/unit/matcher_t.c
test/unit/run.c

index b18ef94f42a2fdcf83a9abfc7fbeb2f396047cdc..499de32a4f9e1d935a861d47f4deae3b321b887a 100644 (file)
@@ -24,17 +24,17 @@ enum {
 
 static struct dm_pool *mem;
 
-int bitset_init() {
+int bitset_init(void) {
        mem = dm_pool_create("bitset test", 1024);
        return mem == NULL;
 }
 
-int bitset_fini() {
+int bitset_fini(void) {
        dm_pool_destroy(mem);
        return 0;
 }
 
-static void test_get_next()
+static void test_get_next(void)
 {
         int i, j, last = 0, first;
         dm_bitset_t bs = dm_bitset_create(mem, NR_BITS);
@@ -68,7 +68,7 @@ static void bit_flip(dm_bitset_t bs, int bit)
                 dm_bit_set(bs, bit);
 }
 
-static void test_equal()
+static void test_equal(void)
 {
         dm_bitset_t bs1 = dm_bitset_create(mem, NR_BITS);
         dm_bitset_t bs2 = dm_bitset_create(mem, NR_BITS);
@@ -92,7 +92,7 @@ static void test_equal()
         }
 }
 
-static void test_and()
+static void test_and(void)
 {
         dm_bitset_t bs1 = dm_bitset_create(mem, NR_BITS);
         dm_bitset_t bs2 = dm_bitset_create(mem, NR_BITS);
@@ -131,4 +131,3 @@ CU_TestInfo bitset_list[] = {
        { (char*)"and", test_and },
        CU_TEST_INFO_NULL
 };
-
index 1425868033b289c992e5ceec668d39c500fe2bdd..66fe288620680e0eaabaa8adfaac76a94edb7918 100644 (file)
 #include "libdevmapper.h"
 #include <CUnit/CUnit.h>
 
+int config_init(void);
+int config_fini(void);
+
 static struct dm_pool *mem;
 
-int config_init() {
+int config_init(void) {
        mem = dm_pool_create("config test", 1024);
        return mem == NULL;
 }
 
-int config_fini() {
+int config_fini(void) {
        dm_pool_destroy(mem);
        return 0;
 }
@@ -45,12 +48,12 @@ static const char *conf =
        "    }\n"
        "}\n";
 
-static void test_parse()
+static void test_parse(void)
 {
        struct dm_config_tree *tree = dm_config_from_string(conf);
-       struct dm_config_value *value;
+       const struct dm_config_value *value;
 
-       CU_ASSERT(tree);
+       CU_ASSERT((long) tree);
        CU_ASSERT(dm_config_has_node(tree->root, "id"));
        CU_ASSERT(dm_config_has_node(tree->root, "physical_volumes"));
        CU_ASSERT(dm_config_has_node(tree->root, "physical_volumes/pv0"));
@@ -77,11 +80,11 @@ static void test_parse()
        dm_config_destroy(tree);
 }
 
-static void test_clone()
+static void test_clone(void)
 {
        struct dm_config_tree *tree = dm_config_from_string(conf);
        struct dm_config_node *n = dm_config_clone_node(tree, tree->root, 1);
-       struct dm_config_value *value;
+       const struct dm_config_value *value;
 
        /* Check that the nodes are actually distinct. */
        CU_ASSERT(n != tree->root);
@@ -112,6 +115,8 @@ static void test_clone()
        CU_ASSERT(value->next == NULL); /* an empty list */
        CU_ASSERT(dm_config_get_list(n, "status", &value));
        CU_ASSERT(value->next != NULL); /* a non-empty list */
+
+       dm_config_destroy(tree);
 }
 
 CU_TestInfo config_list[] = {
@@ -119,4 +124,3 @@ CU_TestInfo config_list[] = {
        { (char*)"clone", test_clone },
        CU_TEST_INFO_NULL
 };
-
index da96ef9420ac4d1a6d7f2e1a0dfb89fad47486cb..e3a5784b0cbe6aebebd767adb2d8a53ca6590bbb 100644 (file)
@@ -33,27 +33,28 @@ int regex_fini(void);
 
 static struct dm_pool *mem = NULL;
 
-int regex_init() {
+int regex_init(void) {
        mem = dm_pool_create("bitset test", 1024);
        return mem == NULL;
 }
 
-int regex_fini() {
+int regex_fini(void) {
        dm_pool_destroy(mem);
        return 0;
 }
 
 static struct dm_regex *make_scanner(const char **rx)
 {
+       struct dm_regex *scanner;
        int nrx = 0;
        for (; rx[nrx]; ++nrx);
 
-       struct dm_regex *scanner = dm_regex_create(mem, rx, nrx);
+       scanner = dm_regex_create(mem, rx, nrx);
        CU_ASSERT_FATAL(scanner != NULL);
        return scanner;
 }
 
-static void test_fingerprints() {
+static void test_fingerprints(void) {
        struct dm_regex *scanner;
 
        scanner = make_scanner(dev_patterns);
@@ -63,7 +64,7 @@ static void test_fingerprints() {
        CU_ASSERT_EQUAL(dm_regex_fingerprint(scanner), 0xeed8ceb8);
 }
 
-static void test_matching() {
+static void test_matching(void) {
        struct dm_regex *scanner;
        int i;
 
index 165c3454d409b7f66a03fd492cb2b7ed8033efd2..734385587453acfd8548b9a2e57940c9d8749150 100644 (file)
@@ -3,8 +3,8 @@
 
 #define DECL(n) \
        extern CU_TestInfo n ## _list[]; \
-       int n ## _init(); \
-       int n ## _fini();
+       int n ## _init(void); \
+       int n ## _fini(void);
 #define USE(n) { (char*) #n, n##_init, n##_fini, n##_list }
 
 DECL(bitset);
@@ -18,7 +18,7 @@ CU_SuiteInfo suites[] = {
        CU_SUITE_INFO_NULL
 };
 
-int main() {
+int main(int argc, char **argv) {
        CU_initialize_registry();
        CU_register_suites(suites);
        CU_basic_set_mode(CU_BRM_VERBOSE);
This page took 0.04589 seconds and 5 git commands to generate.