Przeglądaj źródła

test_interfaces: Change `register_func_t' to return a `starpu_data_handle'.

Ludovic Courtès 13 lat temu
rodzic
commit
33a2088388

+ 1 - 1
tests/datawizard/interfaces/test_interfaces.c

@@ -142,7 +142,7 @@ create_task(struct starpu_task **taskp, enum starpu_archtype type, int id)
 	struct starpu_task *task = starpu_task_create();
 	task->synchronous = 1;
 	task->cl = &cl;
-	task->buffers[0].handle = *(current_config->register_func());
+	task->buffers[0].handle = current_config->register_func();
 	task->buffers[0].mode = STARPU_RW;
 	if (id != -1)
 	{

+ 2 - 2
tests/datawizard/interfaces/test_interfaces.h

@@ -14,9 +14,9 @@
  * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  */
 #ifndef TEST_INTERFACES_H
-#define TEST_INTERFACES_H 
+#define TEST_INTERFACES_H
 
-typedef starpu_data_handle* (*register_func_t) (void);
+typedef starpu_data_handle (*register_func_t) (void);
 
 struct test_config {
 	/* Returns a valid handle to a piece of data registered by StarPU */

+ 4 - 7
tests/datawizard/interfaces/test_vector_interface.c

@@ -17,7 +17,7 @@
 #include "test_interfaces.h"
 
 /* Prototypes */
-static starpu_data_handle *register_data(void);
+static starpu_data_handle register_data(void);
 static void test_vector_cpu_func(void *buffers[], void *args);
 #ifdef STARPU_USE_CUDA
 extern void test_vector_cuda_func(void *buffers[], void *_args);
@@ -27,7 +27,7 @@ extern void test_vector_opencl_func(void *buffers[], void *args);
 #endif
 
 
-static starpu_data_handle *vector_handle;
+static starpu_data_handle vector_handle;
 
 struct test_config vector_config = {
 	.cpu_func      = test_vector_cpu_func,
@@ -45,7 +45,7 @@ struct test_config vector_config = {
 int n = 16;
 int *vector;
 
-static starpu_data_handle*
+static starpu_data_handle
 register_data(void)
 {
 	if (vector_handle)
@@ -60,10 +60,7 @@ register_data(void)
 		vector[i] = i;
 
 	/* Registering data */
-	vector_handle = malloc(sizeof(*vector_handle));
-	if (!vector_handle)
-		return NULL;
-	starpu_vector_data_register(vector_handle,
+	starpu_vector_data_register(&vector_handle,
                                     0,
                                     (uintptr_t)vector,
                                      n,