argc++;
argv = xbt_new(char *, argc + 1);
- argv[0] = strdup("java");
+ argv[0] = xbt_strdup("java");
for (index = 0; index < argc - 1; index++) {
jval = (jstring) (*env)->GetObjectArrayElement(env, jargs, index);
tmp = (*env)->GetStringUTFChars(env, jval, 0);
- argv[index + 1] = strdup(tmp);
+ argv[index + 1] = xbt_strdup(tmp);
(*env)->ReleaseStringUTFChars(env, jval, tmp);
}
argv[argc] = NULL;
return 0;
}
-
}
const char *name = (*env)->GetStringUTFChars(env, jname, 0);
const char *value_java = (*env)->GetStringUTFChars(env, jvalue, 0);
- char *value = strdup(value_java);
+ char *value = xbt_strdup(value_java);
MSG_host_set_property_value(host, name, value, xbt_free_f);
}
const char *name = (*env)->GetStringUTFChars(env, jname, 0);
const char *value_java = (*env)->GetStringUTFChars(env, jvalue, 0);
- char *value = strdup(value_java);
+ char *value = xbt_strdup(value_java);
MSG_storage_set_property_value(storage, name, value, xbt_free_f);
xbt_dynar_free(&table);
return jtable;
}
-
xbt_assert(key != NULL);
xbt_assert(value != NULL);
- val_cp = strdup(value);
+ val_cp = xbt_strdup(value);
xbt_dict_set(jedule->jedule_meta_info, key, val_cp, NULL);
}
res->index = comm->index;
res->type = comm->type;
res->comm_addr = comm->comm_addr;
- res->rdv = strdup(comm->rdv);
+ res->rdv = xbt_strdup(comm->rdv);
res->data_size = -1;
res->data = NULL;
if (comm->type == SIMIX_COMM_SEND) {
if (!address)
return NULL;
if (this->is_self())
- return strdup((char*) address.address());
+ return xbt_strdup((char*) address.address());
off_t len = 128;
char* res = (char*) malloc(len);
memcpy((*new_t)->substruct, datatype->substruct, sizeof(s_smpi_mpi_struct_t));
}
if(datatype->name)
- (*new_t)->name = strdup(datatype->name);
+ (*new_t)->name = xbt_strdup(datatype->name);
if(datatype->attributes !=NULL){
(*new_t)->attributes=xbt_dict_new();
xbt_dict_cursor_t cursor = NULL;
}
void smpi_datatype_set_name(MPI_Datatype datatype, char* name){
- datatype->name = strdup(name);;
+ datatype->name = xbt_strdup(name);;
}
int smpi_datatype_copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
*position += outcount * size;
return MPI_SUCCESS;
}
-
}
void smpi_mpi_win_set_name(MPI_Win win, char* name){
- win->name = strdup(name);;
+ win->name = xbt_strdup(name);;
}
win->opened--; //we're opened for business !
return MPI_SUCCESS;
}
-
-
-
xbt_automaton_state_t state = NULL;
state = xbt_new0(struct xbt_automaton_state, 1);
state->type = type;
- state->id = strdup(id);
+ state->id = xbt_strdup(id);
state->in = xbt_dynar_new(sizeof(xbt_automaton_transition_t), xbt_automaton_transition_free_voidp);
state->out = xbt_dynar_new(sizeof(xbt_automaton_transition_t), xbt_automaton_transition_free_voidp);
xbt_dynar_push(a->states, &state);
}
case 3 :{
char* p = va_arg(ap, char*);
- label->u.predicat = strdup(p);
+ label->u.predicat = xbt_strdup(p);
break;
}
}
xbt_automaton_propositional_symbol_t xbt_automaton_propositional_symbol_new(xbt_automaton_t a, const char* id, int(*fct)(void)){
xbt_automaton_propositional_symbol_t prop_symb = NULL;
prop_symb = xbt_new0(struct xbt_automaton_propositional_symbol, 1);
- prop_symb->pred = strdup(id);
+ prop_symb->pred = xbt_strdup(id);
prop_symb->callback = call_simple_function;
prop_symb->data = fct;
prop_symb->free_function = NULL;
{
xbt_automaton_propositional_symbol_t prop_symb = NULL;
prop_symb = xbt_new0(struct xbt_automaton_propositional_symbol, 1);
- prop_symb->pred = strdup(id);
+ prop_symb->pred = xbt_strdup(id);
prop_symb->callback = NULL;
prop_symb->data = value;
prop_symb->free_function = NULL;
{
xbt_automaton_propositional_symbol_t prop_symb = NULL;
prop_symb = xbt_new0(struct xbt_automaton_propositional_symbol, 1);
- prop_symb->pred = strdup(id);
+ prop_symb->pred = xbt_strdup(id);
prop_symb->callback = callback;
prop_symb->data = data;
prop_symb->free_function = free_function;
static void new_state(char* id, int src){
- char* id_state = strdup(id);
+ char* id_state = xbt_strdup(id);
char* first_part = strtok(id,"_");
int type = 0 ; // -1=initial state; 0=intermediate state; 1=final state
parsed_automaton->current_state = state;
if(src)
- state_id_src = strdup(id_state);
+ state_id_src = xbt_strdup(id_state);
}
static void new_transition(char* id, xbt_automaton_exp_label_t label){
- char* id_state = strdup(id);
+ char* id_state = xbt_strdup(id);
xbt_automaton_state_t state_dst = NULL;
new_state(id, 0);
state_dst = xbt_automaton_state_exists(parsed_automaton, id_state);
fill(&head, homogeneous);
count_check_get_key(head, 7);
xbt_test_add("Change 123 to 'Changed 123'");
- xbt_dict_set(head, "123", strdup("Changed 123"), free_f);
+ xbt_dict_set(head, "123", xbt_strdup("Changed 123"), free_f);
count_check_get_key(head, 7);
xbt_test_add("Change 123 back to '123'");
- xbt_dict_set(head, "123", strdup("123"), free_f);
+ xbt_dict_set(head, "123", xbt_strdup("123"), free_f);
count_check_get_key(head, 7);
xbt_test_add("Change 12a to 'Dummy 12a'");
- xbt_dict_set(head, "12a", strdup("Dummy 12a"), free_f);
+ xbt_dict_set(head, "12a", xbt_strdup("Dummy 12a"), free_f);
count_check_get_key(head, 7);
xbt_test_add("Change 12a to '12a'");
- xbt_dict_set(head, "12a", strdup("12a"), free_f);
+ xbt_dict_set(head, "12a", xbt_strdup("12a"), free_f);
count_check_get_key(head, 7);
xbt_test_add("Traverse the resulting dictionary");
/* 1. Populate the dynar */
for (cpt = 0; cpt < NB_ELEM; cpt++) {
sprintf(buf, "%d", cpt);
- s1 = strdup(buf);
+ s1 = xbt_strdup(buf);
xbt_dynar_push(d, &s1);
}
for (cpt = 0; cpt < NB_ELEM; cpt++) {
sprintf(buf, "%d", cpt);
- s1 = strdup(buf);
+ s1 = xbt_strdup(buf);
xbt_dynar_replace(d, cpt, &s1);
}
for (cpt = 0; cpt < NB_ELEM; cpt++) {
sprintf(buf, "%d", cpt);
- s1 = strdup(buf);
+ s1 = xbt_strdup(buf);
xbt_dynar_replace(d, cpt, &s1);
}
for (cpt = 0; cpt < NB_ELEM; cpt++) {
sprintf(buf, "%d", cpt);
- s1 = strdup(buf);
+ s1 = xbt_strdup(buf);
xbt_dynar_replace(d, cpt, &s1);
}
for (cpt = 0; cpt < NB_ELEM; cpt++) {
d = xbt_dynar_new(sizeof(char **), &xbt_free_ref);
for (cpt = 0; cpt < NB_ELEM; cpt++) {
sprintf(buf, "%d", cpt);
- s1 = strdup(buf);
+ s1 = xbt_strdup(buf);
xbt_dynar_unshift(d, &s1);
}
/* 2. Traverse the dynar with the macro */
d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
for (cpt = 0; cpt < NB_ELEM; cpt++) {
sprintf(buf, "%d", cpt);
- s1 = strdup(buf);
+ s1 = xbt_strdup(buf);
xbt_dynar_push(d, &s1);
}
for (cpt = 0; cpt < NB_ELEM / 5; cpt++) {
sprintf(buf, "%d", cpt);
- s1 = strdup(buf);
+ s1 = xbt_strdup(buf);
xbt_dynar_insert_at(d, NB_ELEM / 2, &s1);
}
d = xbt_dynar_new(sizeof(char *), &xbt_free_ref);
for (cpt = 0; cpt < NB_ELEM; cpt++) {
sprintf(buf, "%d", cpt);
- s1 = strdup(buf);
+ s1 = xbt_strdup(buf);
xbt_dynar_push(d, &s1);
}
for (cpt = 2 * (NB_ELEM / 5); cpt < 4 * (NB_ELEM / 5); cpt++) {