result = xbt_dynar_new(sizeof(SD_task_t), dot_task_p_free);
jobs = xbt_dict_new_homogeneous(NULL);
FILE *in_file = fopen(filename, "r");
+ if (in_file == NULL)
+ xbt_die("Failed to open file: %s", filename);
dag_dot = agread(in_file, NIL(Agdisc_t *));
SD_task_t root, end, task;
/*
/* try to take the information to schedule the task only if all is
* right*/
int performer, order;
- char *char_performer, *char_order;
+ char *char_performer = agget(node, (char *) "performer");
+ char *char_order = agget(node, (char *) "order");
/* performer is the computer which execute the task */
performer =
- (!strcmp((char_performer = agget(node, (char *) "performer")), "")?
- -1:atoi(char_performer));
+ ((!char_performer || !strcmp(char_performer,"")) ? -1:atoi(char_performer));
/* order is giving the task order on one computer */
- order = (!strcmp((char_order = agget(node, (char *) "order")), "")?
- -1:atoi(char_order));
+ order = ((!char_order || !strcmp(char_order, ""))? -1:atoi(char_order));
XBT_DEBUG ("Task '%s' is scheduled on workstation '%d' in position '%d'",
task->name, performer, order);
agclose(dag_dot);
xbt_dict_free(&jobs);
+ fclose(in_file);
if (!acyclic_graph_detail(result)) {
XBT_ERROR("The DOT described in %s is not a DAG. It contains a cycle.",