The main goal for this patch is to remove the cast for the argument of
free() in MSG_action_runner().
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9613
48e7efb5-ca39-0410-a469-
dd3cf9ba447f
"Messages specific for this msg example");
int communicator_size = 0;
"Messages specific for this msg example");
int communicator_size = 0;
-static void action_Isend(char*const* action);
+static void action_Isend(const char *const *action);
typedef struct {
int last_Irecv_sender_id;
typedef struct {
int last_Irecv_sender_id;
-static void action_send(char*const* action)
+static void action_send(const char *const *action)
{
char *name = NULL;
char to[250];
{
char *name = NULL;
char to[250];
asynchronous_cleanup();
}
asynchronous_cleanup();
}
-static void action_Isend(char*const* action)
+static void action_Isend(const char *const *action)
{
char to[250];
const char *size = action[3];
{
char to[250];
const char *size = action[3];
-static void action_recv(char*const* action)
+static void action_recv(const char *const *action)
{
char *name = NULL;
char mailbox_name[250];
{
char *name = NULL;
char mailbox_name[250];
asynchronous_cleanup();
}
asynchronous_cleanup();
}
-static void action_Irecv(char*const* action)
+static void action_Irecv(const char *const *action)
{
char mailbox[250];
double clock = MSG_get_clock();
{
char mailbox[250];
double clock = MSG_get_clock();
-static void action_wait(char*const* action)
+static void action_wait(const char *const *action)
{
char *name = NULL;
m_task_t task = NULL;
{
char *name = NULL;
m_task_t task = NULL;
}
/* FIXME: that's a poor man's implementation: we should take the message exchanges into account */
}
/* FIXME: that's a poor man's implementation: we should take the message exchanges into account */
-static void action_barrier(char*const* action)
+static void action_barrier(const char *const *action)
{
char *name = NULL;
static smx_mutex_t mutex = NULL;
{
char *name = NULL;
static smx_mutex_t mutex = NULL;
-static void action_reduce(char*const* action)
+static void action_reduce(const char *const *action)
{
int i;
char *reduce_identifier;
{
int i;
char *reduce_identifier;
free(reduce_identifier);
}
free(reduce_identifier);
}
-static void action_bcast(char*const* action)
+static void action_bcast(const char *const *action)
{
int i;
char *bcast_identifier;
{
int i;
char *bcast_identifier;
-static void action_sleep(char*const* action)
+static void action_sleep(const char *const *action)
{
char *name = NULL;
const char *duration = action[2];
{
char *name = NULL;
const char *duration = action[2];
-static void action_allReduce(char*const* action) {
+static void action_allReduce(const char *const *action) {
int i;
char *allreduce_identifier;
char mailbox[80];
int i;
char *allreduce_identifier;
char mailbox[80];
free(allreduce_identifier);
}
free(allreduce_identifier);
}
-static void action_comm_size(char*const* action)
+static void action_comm_size(const char *const *action)
{
char *name = NULL;
const char *size = action[2];
{
char *name = NULL;
const char *size = action[2];
-static void action_compute(char*const* action)
+static void action_compute(const char *const *action)
{
char *name = NULL;
const char *amout = action[2];
{
char *name = NULL;
const char *amout = action[2];
-static void action_init(char*const* action)
+static void action_init(const char *const *action)
{
#ifdef HAVE_TRACING
TRACE_smpi_init(get_rank(MSG_process_get_name(MSG_process_self())));
{
#ifdef HAVE_TRACING
TRACE_smpi_init(get_rank(MSG_process_get_name(MSG_process_self())));
-static void action_finalize(char*const* action)
+static void action_finalize(const char *const *action)
{
#ifdef HAVE_TRACING
TRACE_smpi_finalize(get_rank(MSG_process_get_name(MSG_process_self())));
{
#ifdef HAVE_TRACING
TRACE_smpi_finalize(get_rank(MSG_process_get_name(MSG_process_self())));
double timeout);
/************************** Action handling **********************************/
double timeout);
/************************** Action handling **********************************/
-typedef void (*msg_action_fun) (char*const* args);
+typedef void (*msg_action_fun) (const char *const *args);
XBT_PUBLIC(void) MSG_action_register(const char *action_name,
msg_action_fun function);
XBT_PUBLIC(void) MSG_action_unregister(const char *action_name);
XBT_PUBLIC(void) MSG_action_register(const char *action_name,
msg_action_fun function);
XBT_PUBLIC(void) MSG_action_unregister(const char *action_name);
typedef struct s_replay_trace_reader *xbt_replay_trace_reader_t;
xbt_replay_trace_reader_t xbt_replay_trace_reader_new(const char*filename);
typedef struct s_replay_trace_reader *xbt_replay_trace_reader_t;
xbt_replay_trace_reader_t xbt_replay_trace_reader_new(const char*filename);
-char * const *xbt_replay_trace_reader_get(xbt_replay_trace_reader_t reader);
+const char **xbt_replay_trace_reader_get(xbt_replay_trace_reader_t reader);
void xbt_replay_trace_reader_free(xbt_replay_trace_reader_t *reader);
const char *xbt_replay_trace_reader_position(xbt_replay_trace_reader_t reader);
void xbt_replay_trace_reader_free(xbt_replay_trace_reader_t *reader);
const char *xbt_replay_trace_reader_position(xbt_replay_trace_reader_t reader);
XBT_PUBLIC(xbt_dynar_t) xbt_str_split_str(const char *s, const char *sep);
XBT_PUBLIC(char *) xbt_str_join(xbt_dynar_t dynar, const char *sep);
XBT_PUBLIC(xbt_dynar_t) xbt_str_split_str(const char *s, const char *sep);
XBT_PUBLIC(char *) xbt_str_join(xbt_dynar_t dynar, const char *sep);
-XBT_PUBLIC(char *) xbt_str_join_array(char*const* strs, const char *sep);
+XBT_PUBLIC(char *) xbt_str_join_array(const char *const *strs, const char *sep);
/* */
XBT_PUBLIC(void) xbt_str_subst(char *str, char from, char to, int amount);
/* */
XBT_PUBLIC(void) xbt_str_subst(char *str, char from, char to, int amount);
static char *action_line = NULL;
static size_t action_len = 0;
static char *action_line = NULL;
static size_t action_len = 0;
-static char*const* action_get_action(char *name);
+static const char **action_get_action(char *name);
/** \ingroup msg_actions
* \brief Registers a function to handle a kind of action
/** \ingroup msg_actions
* \brief Registers a function to handle a kind of action
static int MSG_action_runner(int argc, char *argv[])
{
static int MSG_action_runner(int argc, char *argv[])
{
if (action_fp) { // A unique trace file
while ((evt = action_get_action(argv[0]))) {
msg_action_fun function = xbt_dict_get(action_funs, evt[1]);
(*function) (evt);
if (action_fp) { // A unique trace file
while ((evt = action_get_action(argv[0]))) {
msg_action_fun function = xbt_dict_get(action_funs, evt[1]);
(*function) (evt);
}
} else { // Should have got my trace file in argument
xbt_assert1(argc >= 2,
}
} else { // Should have got my trace file in argument
xbt_assert1(argc >= 2,
if (!strcmp(argv[0],evt[0])) {
msg_action_fun function = xbt_dict_get(action_funs, evt[1]);
(*function) (evt);
if (!strcmp(argv[0],evt[0])) {
msg_action_fun function = xbt_dict_get(action_funs, evt[1]);
(*function) (evt);
} else {
WARN1("%s: Ignore trace element not for me",
xbt_replay_trace_reader_position(reader));
} else {
WARN1("%s: Ignore trace element not for me",
xbt_replay_trace_reader_position(reader));
-static char*const* action_get_action(char *name)
+static const char **action_get_action(char *name)
{
ssize_t read;
xbt_dynar_t evt = NULL;
{
ssize_t read;
xbt_dynar_t evt = NULL;
void replay_trace_reader_free(replay_trace_reader_t *reader);
/* get a new event. Don't free the content, strdup what you want to
keep after next call to reader_get() */
void replay_trace_reader_free(replay_trace_reader_t *reader);
/* get a new event. Don't free the content, strdup what you want to
keep after next call to reader_get() */
- const char * const*replay_trace_reader_get(replay_trace_reader_t r);
+ const char **replay_trace_reader_get(replay_trace_reader_t r);
/* return a "file:pos" description of the last thing we read. */
const char *replay_trace_reader_position(replay_trace_reader_t r);
Check replay_trace_reader.c for souce code, and replay_MPI.c for
/* return a "file:pos" description of the last thing we read. */
const char *replay_trace_reader_position(replay_trace_reader_t r);
Check replay_trace_reader.c for souce code, and replay_MPI.c for
Isn't all this beautifully awful?? A few gotos in your code are just
Isn't all this beautifully awful?? A few gotos in your code are just
-what you need to go 20 years back to the good old time of gwbasic...
\ No newline at end of file
+what you need to go 20 years back to the good old time of gwbasic...
return reader->position;
}
return reader->position;
}
-char * const *xbt_replay_trace_reader_get(xbt_replay_trace_reader_t reader)
+const char **xbt_replay_trace_reader_get(xbt_replay_trace_reader_t reader)
{
ssize_t read;
xbt_dynar_t d;
{
ssize_t read;
xbt_dynar_t d;
* The parameter must be a NULL-terminated array of chars,
* just like xbt_dynar_to_array() produces
*/
* The parameter must be a NULL-terminated array of chars,
* just like xbt_dynar_to_array() produces
*/
-char *xbt_str_join_array(char*const* strs, const char *sep)
+char *xbt_str_join_array(const char *const *strs, const char *sep)
{
char *res,*q;
int amount_strings=0;
{
char *res,*q;
int amount_strings=0;