A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
If the timeout is negative, the user wants to block
[simgrid.git]
/
src
/
simdag
/
sd_link.c
diff --git
a/src/simdag/sd_link.c
b/src/simdag/sd_link.c
index
33448bf
..
1742d7f
100644
(file)
--- a/
src/simdag/sd_link.c
+++ b/
src/simdag/sd_link.c
@@
-7,14
+7,18
@@
/* Creates a link and registers it in SD.
*/
SD_link_t __SD_link_create(void *surf_link, void *data) {
/* Creates a link and registers it in SD.
*/
SD_link_t __SD_link_create(void *surf_link, void *data) {
+
+ SD_link_t link;
+ const char *name;
+
SD_CHECK_INIT_DONE();
xbt_assert0(surf_link != NULL, "surf_link is NULL !");
SD_CHECK_INIT_DONE();
xbt_assert0(surf_link != NULL, "surf_link is NULL !");
-
SD_link_t link = xbt_new0
(s_SD_link_t, 1);
+
link = xbt_new
(s_SD_link_t, 1);
link->surf_link = surf_link;
link->data = data; /* user data */
link->surf_link = surf_link;
link->data = data; /* user data */
-
const char *
name = SD_link_get_name(link);
+ name = SD_link_get_name(link);
xbt_dict_set(sd_global->links, name, link, __SD_link_destroy); /* add the link to the dictionary */
sd_global->link_count++;
xbt_dict_set(sd_global->links, name, link, __SD_link_destroy); /* add the link to the dictionary */
sd_global->link_count++;
@@
-29,16
+33,17
@@
SD_link_t __SD_link_create(void *surf_link, void *data) {
* \see SD_link_get_number()
*/
const SD_link_t* SD_link_get_list(void) {
* \see SD_link_get_number()
*/
const SD_link_t* SD_link_get_list(void) {
- SD_CHECK_INIT_DONE();
- xbt_assert0(SD_link_get_number() > 0, "There is no link!");
xbt_dict_cursor_t cursor;
char *key;
void *data;
int i;
xbt_dict_cursor_t cursor;
char *key;
void *data;
int i;
+
+ SD_CHECK_INIT_DONE();
+ xbt_assert0(SD_link_get_number() > 0, "There is no link!");
if (sd_global->link_list == NULL) { /* this is the first time the function is called */
if (sd_global->link_list == NULL) { /* this is the first time the function is called */
- sd_global->link_list = xbt_new
0
(SD_link_t, sd_global->link_count);
+ sd_global->link_list = xbt_new(SD_link_t, sd_global->link_count);
i = 0;
xbt_dict_foreach(sd_global->links, cursor, key, data) {
i = 0;
xbt_dict_foreach(sd_global->links, cursor, key, data) {