]> AND Public Git Repository - simgrid.git/blobdiff - src/gras/DataDesc/ddt_exchange.c
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use homogeneous dictionaries whenever possible.
[simgrid.git] / src / gras / DataDesc / ddt_exchange.c
index 8069511b5152bcabcaa2c90d1be3d82e378e5c5b..91da76f88c40bf0e985b01c14ecc3936a3a14f31 100644 (file)
@@ -98,7 +98,7 @@ static XBT_INLINE void gras_dd_alloc_ref(xbt_dict_t refs, long int size, char **
            *(void **) r_ref);
 
     if (detect_cycle)
-      xbt_dict_set_ext(refs, (const char *) r_ref, r_len, ptr, xbt_free_f);
+      xbt_dict_set_ext(refs, (const char *) r_ref, r_len, ptr, NULL);
   }
 }
 
@@ -235,7 +235,7 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
       /* Detect the referenced type */
       sub_type = ref_data.type;
       if (sub_type == NULL) {
-        sub_type = (*ref_data.selector) (type, state, src);
+        sub_type = ref_data.selector(type, state, src);
       }
 
       /* Send the pointed data only if not already sent */
@@ -385,7 +385,6 @@ gras_datadesc_memcpy_rec(gras_cbps_t state,
  */
 int gras_datadesc_memcpy(gras_datadesc_type_t type, void *src, void *dst)
 {
-  xbt_ex_t e;
   static gras_cbps_t state = NULL;
   static xbt_dict_t refs = NULL;        /* all references already sent */
   int size = 0;
@@ -396,17 +395,19 @@ int gras_datadesc_memcpy(gras_datadesc_type_t type, void *src, void *dst)
          dst);
   if (!state) {
     state = gras_cbps_new();
-    refs = xbt_dict_new();
+    refs = xbt_dict_new_homogeneous(xbt_free_f);
   }
 
   TRY {
     size =
         gras_datadesc_memcpy_rec(state, refs, type, (char *) src,
                                  (char *) dst, 0, type->cycle);
-  } TRY_CLEANUP {
+  }
+  TRY_CLEANUP {
     xbt_dict_reset(refs);
     gras_cbps_reset(state);
-  } CATCH(e) {
+  }
+  CATCH_ANONYMOUS {
     RETHROW;
   }
   return size;
@@ -524,7 +525,7 @@ gras_datadesc_send_rec(gras_socket_t sock,
       /* Detect the referenced type and send it to peer if needed */
       sub_type = ref_data.type;
       if (sub_type == NULL) {
-        sub_type = (*ref_data.selector) (type, state, data);
+        sub_type = ref_data.selector(type, state, data);
         gras_dd_send_int(sock, &(sub_type->code), 1 /*stable */ );
       }
 
@@ -630,8 +631,6 @@ gras_datadesc_send_rec(gras_socket_t sock,
 void gras_datadesc_send(gras_socket_t sock,
                         gras_datadesc_type_t type, void *src)
 {
-
-  xbt_ex_t e;
   static gras_cbps_t state = NULL;
   static xbt_dict_t refs = NULL;        /* all references already sent */
 
@@ -639,16 +638,18 @@ void gras_datadesc_send(gras_socket_t sock,
 
   if (!state) {
     state = gras_cbps_new();
-    refs = xbt_dict_new();
+    refs = xbt_dict_new_homogeneous(NULL);
   }
 
   TRY {
     gras_datadesc_send_rec(sock, state, refs, type, (char *) src,
                            type->cycle);
-  } TRY_CLEANUP {
+  }
+  TRY_CLEANUP {
     xbt_dict_reset(refs);
     gras_cbps_reset(state);
-  } CATCH(e) {
+  }
+  CATCH_ANONYMOUS {
     RETHROW;
   }
 }
@@ -970,24 +971,24 @@ void
 gras_datadesc_recv(gras_socket_t sock,
                    gras_datadesc_type_t type, int r_arch, void *dst)
 {
-
-  xbt_ex_t e;
   static gras_cbps_t state = NULL;      /* callback persistent state */
   static xbt_dict_t refs = NULL;        /* all references already sent */
 
   if (!state) {
     state = gras_cbps_new();
-    refs = xbt_dict_new();
+    refs = xbt_dict_new_homogeneous(xbt_free_f);
   }
 
   xbt_assert(type, "called with NULL type descriptor");
   TRY {
     gras_datadesc_recv_rec(sock, state, refs, type,
                            r_arch, NULL, 0, (char *) dst, -1, type->cycle);
-  } TRY_CLEANUP {
+  }
+  TRY_CLEANUP {
     xbt_dict_reset(refs);
     gras_cbps_reset(state);
-  } CATCH(e) {
+  }
+  CATCH_ANONYMOUS {
     RETHROW;
   }
 }