[network-manager-openvpn/th/ovpn-import-bgo761285] fixup! properties/test: remove unused 'detail'



commit f57a9ba41b1d23984c56023c51dd07219b4d08c4
Author: Thomas Haller <thaller redhat com>
Date:   Sun Feb 7 19:02:08 2016 +0100

    fixup! properties/test: remove unused 'detail'

 properties/tests/test-import-export.c |    2 +-
 shared/nm-test-utils.h                |   17 ++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index b2a8f0f..557903d 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -1310,7 +1310,7 @@ int main (int argc, char **argv)
        nmtst_init (&argc, &argv, TRUE);
 
 #define _add_test_func_simple(func)       g_test_add_func ("/ovpn/properties/" #func, func)
-#define _add_test_func(detail, func, ...) nmtst_add_test_func ("/ovpn/properties/" detail, func, 
##__VA_ARGS__)
+#define _add_test_func(detail, func, ...) nmtst_add_test_func ("/ovpn/properties/" detail, NULL, func, 
##__VA_ARGS__)
 
        _add_test_func_simple (test_password_import);
        _add_test_func_simple (test_password_export);
diff --git a/shared/nm-test-utils.h b/shared/nm-test-utils.h
index b6bc332..ed31579 100644
--- a/shared/nm-test-utils.h
+++ b/shared/nm-test-utils.h
@@ -656,13 +656,14 @@ typedef void (*NmtstTestDataRelease) (const NmtstTestData *test_data);
 
 struct _NmtstTestData {
        const char *testpath;
+       const char *detail;
        NmtstTestDataRelease fcn_release;
        gsize n_args;
        gpointer args[1];
 };
 
 inline static void
-_nmtst_test_data_unpack (const NmtstTestData *test_data, gsize n_args, ...)
+_nmtst_test_data_unpack_detail (const NmtstTestData *test_data, const char **detail, gsize n_args, ...)
 {
        gsize i;
        va_list ap;
@@ -671,6 +672,9 @@ _nmtst_test_data_unpack (const NmtstTestData *test_data, gsize n_args, ...)
        g_assert (test_data);
        g_assert_cmpint (n_args, ==, test_data->n_args);
 
+       if (detail)
+               *detail = test_data->detail;
+
        va_start (ap, n_args);
        for (i = 0; i < n_args; i++) {
                p = va_arg (ap, gpointer *);
@@ -680,7 +684,8 @@ _nmtst_test_data_unpack (const NmtstTestData *test_data, gsize n_args, ...)
        }
        va_end (ap);
 }
-#define nmtst_test_data_unpack(test_data, ...) _nmtst_test_data_unpack(test_data, NM_NARG (__VA_ARGS__), 
##__VA_ARGS__)
+#define nmtst_test_data_unpack_detail(test_data, detail, ...) _nmtst_test_data_unpack_detail(test_data, 
detail, NM_NARG (__VA_ARGS__), ##__VA_ARGS__)
+#define nmtst_test_data_unpack(test_data, ...)                nmtst_test_data_unpack(test_data, NULL, 
##__VA_ARGS__)
 
 inline static void
 _nmtst_test_data_free (gpointer data)
@@ -693,11 +698,12 @@ _nmtst_test_data_free (gpointer data)
                test_data->fcn_release (test_data);
 
        g_free ((gpointer) test_data->testpath);
+       g_free ((gpointer) test_data->detail);
        g_free (test_data);
 }
 
 inline static void
-_nmtst_add_test_func_full (const char *testpath, GTestDataFunc test_func, NmtstTestDataRelease fcn_release, 
gsize n_args, ...)
+_nmtst_add_test_func_full (const char *testpath, const char *detail, GTestDataFunc test_func, 
NmtstTestDataRelease fcn_release, gsize n_args, ...)
 {
        gsize i;
        NmtstTestData *data;
@@ -706,6 +712,7 @@ _nmtst_add_test_func_full (const char *testpath, GTestDataFunc test_func, NmtstT
        data = g_malloc (G_STRUCT_OFFSET (NmtstTestData, args) + sizeof (gpointer) * (n_args + 1));
 
        data->testpath = g_strdup (testpath);
+       data->detail = g_strdup (detail);
        data->fcn_release = fcn_release;
        data->n_args = n_args;
        va_start (ap, n_args);
@@ -719,8 +726,8 @@ _nmtst_add_test_func_full (const char *testpath, GTestDataFunc test_func, NmtstT
                                   test_func,
                                   _nmtst_test_data_free);
 }
-#define nmtst_add_test_func_full(testpath, test_func, fcn_release, ...) _nmtst_add_test_func_full(testpath, 
test_func, fcn_release, NM_NARG (__VA_ARGS__), ##__VA_ARGS__)
-#define nmtst_add_test_func(testpath, test_func, ...) nmtst_add_test_func_full(testpath, test_func, NULL, 
##__VA_ARGS__)
+#define nmtst_add_test_func_full(testpath, detail, test_func, fcn_release, ...) 
_nmtst_add_test_func_full(testpath, detail, test_func, fcn_release, NM_NARG (__VA_ARGS__), ##__VA_ARGS__)
+#define nmtst_add_test_func(testpath, detail, test_func, ...) nmtst_add_test_func_full(testpath, detail, 
test_func, NULL, ##__VA_ARGS__)
 
 /*****************************************************************************/
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]