Просмотр исходного кода

services/confdb.c: avoid four warnings

* services/confdb.c (m2h): New function.
(message_handler_req_lib_confdb_object_iter): Use m2h rather than a cast.
(message_handler_req_lib_confdb_object_find): Likewise.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2105 fd59a12c-fef9-0310-b244-a6a79926bd2f
Jim Meyering 17 лет назад
Родитель
Сommit
a4cae04137
1 измененных файлов с 13 добавлено и 4 удалено
  1. 13 4
      services/confdb.c

+ 13 - 4
services/confdb.c

@@ -54,6 +54,15 @@
 
 LOGSYS_DECLARE_SUBSYS ("CONFDB");
 
+static hdb_handle_t *
+m2h (mar_uint64_t *m)
+{
+	/* FIXME enable the following when/if we use gnulib:
+	   (it's a compile-time assertion; i.e., zero run-time cost)
+	   verify (sizeof (*m) == sizeof (hdb_handle_t)); */
+	return (void *) m;
+}
+
 static struct corosync_api_v1 *api;
 
 static int confdb_exec_init_fn (
@@ -556,13 +565,13 @@ static void message_handler_req_lib_confdb_object_iter (void *conn,
 	if (!req_lib_confdb_object_iter->find_handle) {
 		api->object_find_create(req_lib_confdb_object_iter->parent_object_handle,
 					NULL, 0,
-					&res_lib_confdb_object_iter.find_handle);
+					m2h(&res_lib_confdb_object_iter.find_handle));
 	}
 	else
 		res_lib_confdb_object_iter.find_handle = req_lib_confdb_object_iter->find_handle;
 
 	if (api->object_find_next(res_lib_confdb_object_iter.find_handle,
-				  &res_lib_confdb_object_iter.object_handle)) {
+				  m2h(&res_lib_confdb_object_iter.object_handle))) {
 		ret = CS_ERR_ACCESS;
 		api->object_find_destroy(res_lib_confdb_object_iter.find_handle);
 	}
@@ -592,13 +601,13 @@ static void message_handler_req_lib_confdb_object_find (void *conn,
 		api->object_find_create(req_lib_confdb_object_find->parent_object_handle,
 					req_lib_confdb_object_find->object_name.value,
 					req_lib_confdb_object_find->object_name.length,
-					&res_lib_confdb_object_find.find_handle);
+					m2h(&res_lib_confdb_object_find.find_handle));
 	}
 	else
 		res_lib_confdb_object_find.find_handle = req_lib_confdb_object_find->find_handle;
 
 	if (api->object_find_next(res_lib_confdb_object_find.find_handle,
-				  &res_lib_confdb_object_find.object_handle)) {
+				  m2h(&res_lib_confdb_object_find.object_handle))) {
 		ret = CS_ERR_ACCESS;
 		api->object_find_destroy(res_lib_confdb_object_find.find_handle);
 	}