*/
void xbt_replay_action_register(const char *action_name, action_fun function)
{
+ if (xbt_action_funs == nullptr) // If the user registers a function before the start
+ _xbt_replay_action_init();
+
char* lowername = str_tolower (action_name);
xbt_dict_set(xbt_action_funs, lowername, (void*) function, nullptr);
xbt_free(lowername);
*/
int xbt_replay_action_runner(int argc, char *argv[])
{
- int i;
if (xbt_action_fp) { // A unique trace file
while (true) {
char **evt = action_get_action(argv[0]);
if (evt == nullptr)
- break;
+ break;
char* lowername = str_tolower (evt[1]);
action_fun function = (action_fun)xbt_dict_get(xbt_action_funs, lowername);
catch(xbt_ex& e) {
xbt_die("Replay error :\n %s", e.what());
}
- for (i=0;evt[i]!= nullptr;i++)
+ for (int i=0;evt[i]!= nullptr;i++)
free(evt[i]);
free(evt);
}
xbt_dynar_push(otherqueue, &evt);
}
}
- goto todo_done; // end of file reached while searching in vain for more work
+ // end of file reached while searching in vain for more work
} else {
// Get something from my queue and return it
xbt_dynar_shift(myqueue, &evt);