xbt_assert(mark_type, "mark_type is nullptr");
xbt_assert(mark_value, "mark_value is nullptr");
- simgrid::instr::EventType* type =
+ auto* type =
static_cast<simgrid::instr::EventType*>(simgrid::instr::Container::get_root()->type_->by_name(mark_type));
if (not type) {
throw simgrid::TracingError(XBT_THROW_POINT,
xbt_assert(mark_value, "mark_value is nullptr");
//check if mark_type is already declared
- simgrid::instr::EventType* type =
+ auto* type =
static_cast<simgrid::instr::EventType*>(simgrid::instr::Container::get_root()->type_->by_name(mark_type));
if (not type) {
throw simgrid::TracingError(XBT_THROW_POINT,
xbt_assert(heapinfo1->type >= 0, "Unknown mmalloc block type: %d", heapinfo1->type);
- void* addr_block1 = ((void*)(((ADDR2UINT(i1)) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase));
+ void* addr_block1 = (ADDR2UINT(i1) - 1) * BLOCKSIZE + (char*)state.std_heap_copy.heapbase;
if (heapinfo1->type == MMALLOC_TYPE_UNFRAGMENTED) { /* Large block */
if (is_stack(process, addr_block1)) {
xbt_assert(simgrid::mc::mmu::chunk_count(size()) == get_chunks().page_count());
for (size_t i = 0; i != get_chunks().page_count(); ++i) {
- void* target_page = (void*)simgrid::mc::mmu::join(i, (std::uintptr_t)(void*)start().address());
+ auto* target_page = (void*)simgrid::mc::mmu::join(i, (std::uintptr_t)(void*)start().address());
const void* source_page = get_chunks().page(i);
mc_model_checker->get_remote_process().write_bytes(source_page, xbt_pagesize, remote(target_page));
}
// Read each page:
while (simgrid::mc::mmu::split((std::uintptr_t)addr).first != page_end) {
const void* snapshot_addr = mc_translate_address_region((uintptr_t)addr, this);
- void* next_page = (void*)simgrid::mc::mmu::join(simgrid::mc::mmu::split((std::uintptr_t)addr).first + 1, 0);
+ auto* next_page = (void*)simgrid::mc::mmu::join(simgrid::mc::mmu::split((std::uintptr_t)addr).first + 1, 0);
size_t readable = (char*)next_page - (const char*)addr;
memcpy(dest, snapshot_addr, readable);
addr = (const char*)addr + readable;
xbt_assert(actor_count > 0, "There is no actor!");
std::vector<simgrid::s4u::ActorPtr> actors = e->get_all_actors();
- sg_actor_t* res = xbt_new(sg_actor_t, actors.size());
+ auto* res = xbt_new(sg_actor_t, actors.size());
for (size_t i = 0; i < actor_count; i++)
res[i] = actors[i].get();
return res;
xbt_assert(host_count > 0, "There is no host!");
std::vector<simgrid::s4u::Host*> hosts = e->get_all_hosts();
- sg_host_t* res = xbt_new(sg_host_t, hosts.size());
+ auto* res = xbt_new(sg_host_t, hosts.size());
std::copy(begin(hosts), end(hosts), res);
return res;
{
std::vector<simgrid::s4u::Link*> links = simgrid::s4u::Engine::get_instance()->get_all_links();
- sg_link_t* res = xbt_new(sg_link_t, links.size());
- memcpy(res, links.data(), sizeof(sg_link_t) * links.size());
+ auto* res = xbt_new(sg_link_t, links.size());
+ std::copy(begin(links), end(links), res);
return res;
}
*/
SD_task_t SD_task_create(const char* name, void* data, double amount)
{
- SD_task_t task = xbt_new0(s_SD_task_t, 1);
+ auto* task = xbt_new0(s_SD_task_t, 1);
task->kind = SD_TASK_NOT_TYPED;
task->state = SD_NOT_SCHEDULED;
sd_global->initial_tasks.insert(task);
CHECK_NEGATIVE(2, MPI_ERR_ARG, ndims)
for (int i = 0; i < ndims; i++)
CHECK_NEGATIVE(2, MPI_ERR_ARG, dims[i])
- const simgrid::smpi::Topo_Cart* topo =
- new simgrid::smpi::Topo_Cart(comm, ndims, dims, periodic, reorder, comm_cart);
+ const auto* topo = new simgrid::smpi::Topo_Cart(comm, ndims, dims, periodic, reorder, comm_cart);
if (*comm_cart == MPI_COMM_NULL) {
delete topo;
} else {
CHECK_COMM(1)
CHECK_NULL(1, MPI_ERR_TOPOLOGY, comm->topo())
CHECK_NULL(2, MPI_SUCCESS, coords)
- MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
+ auto* topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
CHECK_NEGATIVE(3, MPI_ERR_ARG, direction)
CHECK_NULL(4, MPI_ERR_ARG, source)
CHECK_NULL(5, MPI_ERR_ARG, dest)
- MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
+ auto* topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
if(maxdims==0 || coords == nullptr) {
return MPI_SUCCESS;
}
- MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
+ auto* topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
CHECK_COMM(1)
CHECK_NULL(1, MPI_ERR_TOPOLOGY, comm->topo())
CHECK_NEGATIVE(3, MPI_ERR_ARG, maxdims)
- MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
+ auto* topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
CHECK_COMM(1)
CHECK_NULL(1, MPI_ERR_TOPOLOGY, comm->topo())
CHECK_NULL(2, MPI_ERR_ARG, ndims)
- const simgrid::smpi::Topo_Cart* topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
+ const auto* topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
CHECK_COMM(1)
CHECK_NULL(1, MPI_ERR_TOPOLOGY, comm->topo())
CHECK_NULL(3, MPI_ERR_ARG, comm_new)
- MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
+ auto* topo = static_cast<MPIR_Cart_Topology>(comm->topo().get());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
- const simgrid::smpi::Topo_Cart* cart = topo->sub(remain_dims, comm_new);
+ const auto* cart = topo->sub(remain_dims, comm_new);
if(*comm_new==MPI_COMM_NULL)
delete cart;
if(cart==nullptr)
int my_local_size=comm_intra->size();
if(comm_intra->rank()==0) {
int is_uniform = 1;
- int* non_uniform_map = xbt_new0(int,leader_group_size);
+ auto* non_uniform_map = xbt_new0(int, leader_group_size);
allgather__ring(&my_local_size, 1, MPI_INT,
non_uniform_map, 1, MPI_INT, leader_comm);
for(i=0; i < leader_group_size; i++) {
*/
xbt_dynar_t xbt_dynar_new(const unsigned long elmsize, void_f_pvoid_t free_f)
{
- xbt_dynar_t dynar = xbt_new0(s_xbt_dynar_t, 1);
+ auto* dynar = xbt_new0(s_xbt_dynar_t, 1);
dynar->size = 0;
dynar->used = 0;
xbt_log_appender_t xbt_log_appender_stream(FILE* f)
{
- xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t, 1);
- res->do_append = &append_file;
- res->free_ = nullptr;
- res->data = static_cast<void*>(f);
+ auto* res = xbt_new0(s_xbt_log_appender_t, 1);
+ res->do_append = &append_file;
+ res->free_ = nullptr;
+ res->data = static_cast<void*>(f);
return res;
}
{
if (arg == nullptr)
return xbt_log_appender_stream(stderr);
- xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t, 1);
- res->do_append = &append_file;
- res->free_ = &free_;
- res->data = static_cast<void*>(fopen(arg, "w"));
+ auto* res = xbt_new0(s_xbt_log_appender_t, 1);
+ res->do_append = &append_file;
+ res->free_ = &free_;
+ res->data = static_cast<void*>(fopen(arg, "w"));
xbt_assert(res->data != nullptr, "Cannot open file: %s: %s", arg, strerror(errno));
return res;
}
//For split, replace % in the file by the current count
xbt_log_appender_t xbt_log_appender2_file_new(const char* arg, int roll)
{
- xbt_log_appender_t res = xbt_new0(s_xbt_log_appender_t, 1);
- res->do_append = &append2_file;
- res->free_ = &free_append2_;
- xbt_log_append2_file_t data = xbt_new0(struct xbt_log_append2_file_s, 1);
+ auto* res = xbt_new0(s_xbt_log_appender_t, 1);
+ res->do_append = &append2_file;
+ res->free_ = &free_append2_;
+ auto* data = xbt_new0(struct xbt_log_append2_file_s, 1);
xbt_assert(arg);
char* buf=xbt_strdup(arg);
char* sep=strchr(buf,':');
xbt_log_layout_t xbt_log_layout_format_new(const char* arg)
{
- xbt_log_layout_t res = xbt_new0(s_xbt_log_layout_t, 1);
- res->do_layout = &xbt_log_layout_format_doit;
- res->free_ = &xbt_log_layout_format_free;
- res->data = xbt_strdup(arg);
+ auto* res = xbt_new0(s_xbt_log_layout_t, 1);
+ res->do_layout = &xbt_log_layout_format_doit;
+ res->free_ = &xbt_log_layout_format_free;
+ res->data = xbt_strdup(arg);
return res;
}
xbt_log_layout_t xbt_log_layout_simple_new(const char*)
{
- xbt_log_layout_t res = xbt_new0(s_xbt_log_layout_t, 1);
- res->do_layout = &xbt_log_layout_simple_doit;
+ auto* res = xbt_new0(s_xbt_log_layout_t, 1);
+ res->do_layout = &xbt_log_layout_simple_doit;
return res;
}