[ofa-general] [PATCH 3/5] [v2.0] dat: fix compiler warnings in dat common code

Arlin Davis arlin.r.davis at intel.com
Mon Sep 1 19:33:31 PDT 2008


dat: fix compiler warnings in dat common code

Signed-off by: Arlin Davis ardavis at ichips.intel.com
---
 dat/common/dat_dr.c |   26 +++++++++++---------------
 dat/common/dat_sr.c |   19 ++++++++++++-------
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/dat/common/dat_dr.c b/dat/common/dat_dr.c
index bda3002..f7e9ffd 100644
--- a/dat/common/dat_dr.c
+++ b/dat/common/dat_dr.c
@@ -173,16 +173,16 @@ DAT_RETURN
 dat_dr_remove (
     IN  const DAT_PROVIDER_INFO *info )
 {
-    DAT_DR_ENTRY 		*data;
     DAT_DICTIONARY_ENTRY 	dict_entry;
     DAT_RETURN 			status;
+    DAT_DICTIONARY_DATA		data;
 
     dict_entry = NULL;
     dat_os_lock (&g_dr_lock);
 
     status = dat_dictionary_search ( g_dr_dictionary,
 				     info,
-				     (DAT_DICTIONARY_DATA *) &data);
+				     &data);
 
     if ( DAT_SUCCESS != status )
     {
@@ -190,7 +190,7 @@ dat_dr_remove (
 	goto bail;
     }
 
-    if ( 0 != data->ref_count )
+    if ( 0 != ((DAT_DR_ENTRY*)data)->ref_count )
     {
 	status = DAT_ERROR (DAT_PROVIDER_IN_USE, 0);
 	goto bail;
@@ -199,7 +199,7 @@ dat_dr_remove (
     status = dat_dictionary_remove ( g_dr_dictionary,
 				     &dict_entry,
 				     info,
-				     (DAT_DICTIONARY_DATA *) &data);
+				     &data);
     if ( DAT_SUCCESS != status )
     {
 	/* return status from dat_dictionary_remove() */
@@ -230,20 +230,18 @@ dat_dr_provider_open (
     OUT DAT_IA_OPEN_FUNC	*p_ia_open_func )
 {
     DAT_RETURN 			status;
-    DAT_DR_ENTRY 		*data;
+    DAT_DICTIONARY_DATA		data;
 
     dat_os_lock (&g_dr_lock);
-
     status = dat_dictionary_search ( g_dr_dictionary,
 				     info,
-				     (DAT_DICTIONARY_DATA *) &data);
-
+				     &data);
     dat_os_unlock (&g_dr_lock);
 
     if ( DAT_SUCCESS == status )
     {
-	data->ref_count++;
-	*p_ia_open_func = data->ia_open_func;
+	((DAT_DR_ENTRY*)data)->ref_count++;
+	*p_ia_open_func = ((DAT_DR_ENTRY*)data)->ia_open_func;
     }
 
     return status;
@@ -259,19 +257,17 @@ dat_dr_provider_close (
     IN  const DAT_PROVIDER_INFO *info )
 {
     DAT_RETURN 			status;
-    DAT_DR_ENTRY 		*data;
+    DAT_DICTIONARY_DATA		data;
 
     dat_os_lock (&g_dr_lock);
-
     status = dat_dictionary_search ( g_dr_dictionary,
 				     info,
-				     (DAT_DICTIONARY_DATA *) &data);
-
+				     &data);
     dat_os_unlock (&g_dr_lock);
 
     if ( DAT_SUCCESS == status )
     {
-	data->ref_count--;
+	((DAT_DR_ENTRY*)data)->ref_count--;
     }
 
     return status;
diff --git a/dat/common/dat_sr.c b/dat/common/dat_sr.c
index 05be499..10319b9 100755
--- a/dat/common/dat_sr.c
+++ b/dat/common/dat_sr.c
@@ -129,12 +129,13 @@ dat_sr_insert (
     IN  DAT_SR_ENTRY 		*entry )
 {
     DAT_RETURN 			status;
-    DAT_SR_ENTRY 		*data, *prev_data;
+    DAT_SR_ENTRY 		*data;
     DAT_OS_SIZE 		lib_path_size;
     DAT_OS_SIZE 		lib_path_len;
     DAT_OS_SIZE 		ia_params_size;
     DAT_OS_SIZE 		ia_params_len;
     DAT_DICTIONARY_ENTRY 	dict_entry;
+    DAT_DICTIONARY_DATA		prev_data;
 
     if ( NULL == (data = dat_os_alloc (sizeof (DAT_SR_ENTRY))) )
     {
@@ -184,7 +185,7 @@ dat_sr_insert (
 
     status = dat_dictionary_search (g_sr_dictionary,
 				    info,
-				    (DAT_DICTIONARY_DATA *) &prev_data);
+				    &prev_data);
     if ( DAT_SUCCESS == status )
     {
 	/* We already have a dictionary entry, so we don't need a new one.
@@ -196,12 +197,12 @@ dat_sr_insert (
 	dict_entry = NULL;
 
 	/* Find the next available slot in this chain */
-	while (NULL != prev_data->next)
+	while (NULL != ((DAT_SR_ENTRY*)prev_data)->next)
 	{
-	    prev_data = prev_data->next;
+	    prev_data = ((DAT_SR_ENTRY*)prev_data)->next;
 	}
 	dat_os_assert (NULL != prev_data);
-	prev_data->next = data;
+	((DAT_SR_ENTRY*)prev_data)->next = data;
     }
     else
     {
@@ -350,15 +351,17 @@ dat_sr_provider_open (
 {
     DAT_RETURN 			status;
     DAT_SR_ENTRY 		*data;
+    DAT_DICTIONARY_DATA		dict_data;
 
     dat_os_lock (&g_sr_lock);
 
     status = dat_dictionary_search (g_sr_dictionary,
 				    info,
-				    (DAT_DICTIONARY_DATA *) &data);
+				    &dict_data);
 
     if ( DAT_SUCCESS == status )
     {
+	data = (DAT_SR_ENTRY*)dict_data;
 	while (data != NULL)
 	{
 	    if ( 0 == data->ref_count )
@@ -450,15 +453,17 @@ dat_sr_provider_close (
 {
     DAT_RETURN 			status;
     DAT_SR_ENTRY 		*data;
+    DAT_DICTIONARY_DATA		dict_data;
 
     dat_os_lock (&g_sr_lock);
 
     status = dat_dictionary_search (g_sr_dictionary,
 				    info,
-				    (DAT_DICTIONARY_DATA *) &data);
+				    &dict_data);
 
     if ( DAT_SUCCESS == status )
     {
+	data = (DAT_SR_ENTRY*)dict_data;
 	while (data != NULL)
 	{
 	    if ( 1 == data->ref_count )
-- 
1.5.2.5





More information about the general mailing list