static gras_datadesc_type_t int_type = NULL;
static gras_datadesc_type_t pointer_type = NULL;
-static _XBT_INLINE void
+static XBT_INLINE void
gras_dd_send_int(gras_socket_t sock,int *i, int stable) {
if (!int_type) {
gras_trp_send(sock, (char*)i, int_type->size[GRAS_THISARCH], stable);
}
-static _XBT_INLINE void
+static XBT_INLINE void
gras_dd_recv_int(gras_socket_t sock, int r_arch, int *i) {
if (!int_type) {
* of 'length' bytes set to 0.
* FIXME: Check in configure?
*/
-static _XBT_INLINE int
+static XBT_INLINE int
gras_dd_is_r_null(char **r_ptr, long int length) {
int i;
return 1;
}
-static _XBT_INLINE void
+static XBT_INLINE void
gras_dd_alloc_ref(xbt_dict_t refs,
long int size,
char **r_ref,
if (detect_cycle && r_ref && !gras_dd_is_r_null( r_ref, r_len)) {
void *ptr = xbt_malloc(sizeof(void *));
- CRITICAL0("Check for cycles");
memcpy(ptr,l_ref, sizeof(void *));
DEBUG2("Insert l_ref=%p under r_ref=%p",*(void**)ptr, *(void**)r_ref);
-
+
if (detect_cycle)
xbt_dict_set_ext(refs,(const char *) r_ref, r_len, ptr, free);
}
reference_is_to_cpy = 0;
TRY {
- if (detect_cycle)
+ if (detect_cycle) {
/* return ignored. Just checking whether it's known or not */
n_ref=xbt_dict_get_ext(refs,(char*)o_ref, sizeof(char*));
- else
+ } else {
reference_is_to_cpy = 1;
+ }
} CATCH(e) {
if (e.category != not_found_error)
RETHROW;
int gras_datadesc_copy(gras_datadesc_type_t type,
void *src, void *dst) {
xbt_ex_t e;
- static gras_cbps_t state=NULL;
- xbt_dict_t refs; /* all references already sent */
+ static gras_cbps_t state=NULL;
+ static xbt_dict_t refs=NULL; /* all references already sent */
int size=0;
xbt_assert0(type,"called with NULL type descriptor");
- refs = xbt_dict_new();
- if (!state)
+ if (!state) {
state = gras_cbps_new();
+ refs = xbt_dict_new();
+ }
TRY {
size = gras_datadesc_copy_rec(state,refs,type,(char*)src,(char*)dst,0,
type->cycle);
} CLEANUP {
- xbt_dict_free(&refs);
+ xbt_dict_reset(refs);
gras_cbps_reset(state);
} CATCH(e) {
RETHROW;
xbt_ex_t e;
static gras_cbps_t state=NULL;
- xbt_dict_t refs; /* all references already sent */
+ static xbt_dict_t refs=NULL; /* all references already sent */
xbt_assert0(type,"called with NULL type descriptor");
- refs = xbt_dict_new();
- if (!state)
+ if (!state) {
state = gras_cbps_new();
-
+ refs = xbt_dict_new();
+ }
+
TRY {
gras_datadesc_send_rec(sock,state,refs,type,(char*)src, type->cycle);
} CLEANUP {
- xbt_dict_free(&refs);
+ xbt_dict_reset(refs);
gras_cbps_reset(state);
} CATCH(e) {
RETHROW;
reference_is_to_recv = 0;
TRY {
- if (detect_cycle)
+ if (detect_cycle) {
l_ref = xbt_dict_get_ext(refs, (char*)r_ref, pointer_type->size[r_arch]);
- else
+ } else {
reference_is_to_recv = 1;
+ }
} CATCH(e) {
if (e.category != not_found_error)
RETHROW;
reference_is_to_recv = 1;
xbt_ex_free(e);
}
+
if (reference_is_to_recv) {
int subsubcount = 0;
void *l_referenced=NULL;
xbt_ex_t e;
static gras_cbps_t state=NULL; /* callback persistent state */
- xbt_dict_t refs; /* all references already sent */
+ static xbt_dict_t refs=NULL; /* all references already sent */
- refs = xbt_dict_new();
- if (!state)
+ if (!state) {
state = gras_cbps_new();
-
+ refs = xbt_dict_new();
+ }
+
xbt_assert0(type,"called with NULL type descriptor");
TRY {
gras_datadesc_recv_rec(sock, state, refs, type,
(char *) dst,-1,
type->cycle);
} CLEANUP {
- xbt_dict_free(&refs);
+ xbt_dict_reset(refs);
gras_cbps_reset(state);
} CATCH(e) {
RETHROW;