-/* $Id$ */
-
/* ddt_exchange - send/recv data described */
-/* Copyright (c) 2003-2009 The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2004, 2005, 2006, 2007, 2009, 2010. The SimGrid Team.
+ * All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
{
- xbt_ex_t e;
unsigned int cpt;
gras_datadesc_type_t sub_type; /* type on which we recurse */
int count = 0;
}
o_ref = (char **) src;
- reference_is_to_cpy = 0;
- TRY {
- 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 {
- reference_is_to_cpy = 1;
- }
- }
- CATCH(e) {
- if (e.category != not_found_error)
- RETHROW;
- reference_is_to_cpy = 1;
- xbt_ex_free(e);
+ reference_is_to_cpy = 1;
+ if (detect_cycle &&
+ (n_ref=xbt_dict_get_or_null_ext(refs, (char *) o_ref, sizeof(char *)))) {
+ /* already known, no need to copy it */
+ //INFO0("Cycle detected");
+ reference_is_to_cpy = 0;
}
if (reference_is_to_cpy) {
char *data, int detect_cycle)
{
- xbt_ex_t e;
unsigned int cpt;
gras_datadesc_type_t sub_type; /* type on which we recurse */
break;
}
- reference_is_to_send = 0;
- TRY {
- if (detect_cycle)
- /* return ignored. Just checking whether it's known or not */
- xbt_dict_get_ext(refs, (char *) ref, sizeof(char *));
- else
- reference_is_to_send = 1;
- }
- CATCH(e) {
- if (e.category != not_found_error)
- RETHROW;
- reference_is_to_send = 1;
- xbt_ex_free(e);
+ reference_is_to_send = 1;
+ /* return ignored. Just checking whether it's known or not */
+ if (detect_cycle && xbt_dict_get_or_null_ext(refs, (char *) ref, sizeof(char *))) {
+ //INFO0("Cycle detected");
+ reference_is_to_send = 0;
}
if (reference_is_to_send) {
unsigned int cpt;
gras_datadesc_type_t sub_type;
- xbt_ex_t e;
VERB2("Recv a %s @%p", type->name, (void *) l_data);
xbt_assert(l_data);
break;
}
- reference_is_to_recv = 0;
- TRY {
- if (detect_cycle) {
- l_ref =
- xbt_dict_get_ext(refs, (char *) r_ref,
- pointer_type->size[r_arch]);
- } else {
- reference_is_to_recv = 1;
- }
- }
- CATCH(e) {
- if (e.category != not_found_error)
- RETHROW;
- reference_is_to_recv = 1;
- xbt_ex_free(e);
+ reference_is_to_recv = 1;
+ if (detect_cycle && (l_ref =
+ xbt_dict_get_or_null_ext(refs, (char *) r_ref,
+ pointer_type->size[r_arch]))) {
+ reference_is_to_recv = 0;
+ //INFO0("Cycle detected");
}
if (reference_is_to_recv) {