Where XXX is 'dict' or 'dynar'.
(was a request from emptty)
{
server_data_t *globals = (server_data_t *) gras_userdata_get();
- if (xbt_dynar_length(globals->waiting_queue)) {
+ if (!xbt_dynar_is_empty(globals->waiting_queue)) {
gras_socket_t s;
xbt_dynar_pop(globals->waiting_queue, &s);
switch (cmd->action) {
case XBT_WORKLOAD_COMPUTE:
/* If any communication were queued, do them in parallel */
- if (xbt_dynar_length(cmd_to_go)) {
+ if (!xbt_dynar_is_empty(cmd_to_go)) {
TRY {
xbt_dynar_dopar(cmd_to_go, do_command);
xbt_dynar_reset(cmd_to_go);
/* do in parallel any communication still queued */
XBT_INFO("Do %ld pending communications after end of TODO list",
xbt_dynar_length(cmd_to_go));
- if (xbt_dynar_length(cmd_to_go)) {
+ if (!xbt_dynar_is_empty(cmd_to_go)) {
xbt_dynar_dopar(cmd_to_go, do_command);
xbt_dynar_reset(cmd_to_go);
}
xbt_dynar_t w = xbt_str_split(line, " ");
- if (xbt_dynar_length(w) == 0) {
+ if (xbt_dynar_is_empty(w)) {
free(res);
xbt_dynar_free(&w);
return NULL;
CS_used = 1;
}
} else { // that's a release. Check if someone was waiting for the lock
- if (xbt_dynar_length(requests) > 0) {
+ if (!xbt_dynar_is_empty(requests)) {
XBT_INFO("CS release. Grant to queued requests (queue size: %lu)",
xbt_dynar_length(requests));
char *req;
count++;
bcast_task_t bt;
- if (xbt_dynar_length(reclaimed)>0) {
+ if (!xbt_dynar_is_empty(reclaimed)) {
bt = xbt_dynar_pop_as(reclaimed,bcast_task_t);
} else {
bt = xbt_new(s_bcast_task_t,1);
xbt_dynar_t done = NULL;
send_one(0,SD_workstation_get_number());
do {
- if (done != NULL && xbt_dynar_length(done) > 0) {
+ if (done != NULL && !xbt_dynar_is_empty(done)) {
unsigned int cursor;
SD_task_t task;
xbt_dynar_free(&done);
}
done=SD_simulate(-1);
- } while(xbt_dynar_length(done) > 0);
+ } while(!xbt_dynar_is_empty(done));
xbt_dynar_free(&done);
xbt_dynar_free(&reclaimed);
parents = SD_task_get_parents(task);
- if (xbt_dynar_length(parents)) {
+ if (!xbt_dynar_is_empty(parents)) {
/* compute last_data_available */
last_data_available = -1.0;
xbt_dynar_foreach(parents, i, parent) {
while (!xbt_dynar_is_empty((changed = SD_simulate(-1.0)))) {
/* Get the set of ready tasks */
ready_tasks = get_ready_tasks(dax);
- if (!xbt_dynar_length(ready_tasks)) {
+ if (xbt_dynar_is_empty(ready_tasks)) {
xbt_dynar_free_container(&ready_tasks);
xbt_dynar_free_container(&changed);
/* there is no ready task, let advance the simulation */
&(computation_amount[1]), SD_SCHED_NO_COST, rate);
/* let's launch the simulation! */
- while (xbt_dynar_length(changed_tasks = SD_simulate(-1.0)) > 0) {
+ while (!xbt_dynar_is_empty(changed_tasks = SD_simulate(-1.0))) {
for (i = 0; i < 2; i++) {
task = SD_workstation_get_current_task(workstations[i]);
if (task)
&(computation_amount[1]), SD_SCHED_NO_COST, rate);
/* let's launch the simulation! */
- while (xbt_dynar_length(changed_tasks = SD_simulate(-1.0)) > 0) {
+ while (!xbt_dynar_is_empty(changed_tasks = SD_simulate(-1.0))) {
for (i = 0; i < 2; i++) {
task = SD_workstation_get_current_task(workstations[i]);
if (task)
lua_pushstring(L,"links");
lua_gettable(L,-2);
links = xbt_str_split(lua_tostring(L, -1), ", \t\r\n");
- if (xbt_dynar_length(links)==0)
+ if (xbt_dynar_is_empty(links))
xbt_dynar_push_as(links,char*,xbt_strdup(lua_tostring(L, -1)));
lua_pop(L,1);
}
xbt_dynar_pop(varstack, &var);
- if (!xbt_dynar_length(varstack)) {
+ if (xbt_dynar_is_empty(varstack)) {
XBT_DEBUG("Last incarnation of %s poped. Kill it", name);
xbt_dict_remove(ps->space, name);
xbt_dynar_free(&varstack);
varstack = xbt_dict_get(ps->space, name);
xbt_dynar_pop(varstack, &var);
- if (!xbt_dynar_length(varstack)) {
+ if (xbt_dynar_is_empty(varstack)) {
xbt_dict_remove(ps->space, name);
xbt_dynar_free_container(&varstack); /*already empty, save a test ;) */
}
{
int ret;
- xbt_assert(xbt_dynar_length(ps->lints) > 0,
+ xbt_assert(!xbt_dynar_is_empty(ps->lints),
"gras_cbps_i_pop: no value to pop");
ret = xbt_dynar_pop_as(ps->lints, int);
XBT_DEBUG("pop %d as a size", ret);
/* get a message (from the queue or from the net) */
timeouted = 0;
- if (xbt_dynar_length(pd->msg_queue)) {
+ if (!xbt_dynar_is_empty(pd->msg_queue)) {
XBT_DEBUG("Get a message from the queue");
xbt_dynar_shift(pd->msg_queue, &msg);
} else {
#ifdef HAVE_READV
if (data->in_buf_v) {
- if (xbt_dynar_length(data->in_buf_v))
+ if (!xbt_dynar_is_empty(data->in_buf_v))
XBT_WARN("Socket closed, but some bytes were unread");
xbt_dynar_free(&data->in_buf_v);
}
if (data->out_buf_v) {
- if (xbt_dynar_length(data->out_buf_v)) {
+ if (!xbt_dynar_is_empty(data->out_buf_v)) {
XBT_DEBUG("Flush the socket before closing");
gras_trp_bufiov_flush(sock);
}
XBT_VERB("GRAS: Finalizing process '%s' (%d)",
SIMIX_req_process_get_name(SIMIX_process_self()), gras_os_getpid());
- if (xbt_dynar_length(msg_pd->msg_queue)) {
+ if (!xbt_dynar_is_empty(msg_pd->msg_queue)) {
unsigned int cpt;
s_gras_msg_t msg;
XBT_WARN
char *name, *name2, *value, *value2;
//check if we do have categories declared
- if (xbt_dict_length(created_categories) == 0){
+ if (xbt_dict_is_empty(created_categories)){
XBT_INFO("No categories declared, ignoring generation of triva graph configuration");
return;
}
buffer = xbt_dynar_new (sizeof(paje_event_t), NULL);
}else{
paje_event_t event;
- while (xbt_dynar_length (buffer) > 0){
+ while (!xbt_dynar_is_empty(buffer)){
double head_timestamp = (*(paje_event_t*)xbt_dynar_get_ptr(buffer, 0))->timestamp;
if (head_timestamp > TRACE_last_timestamp_to_dump){
break;
static void recursiveGraphExtraction (AS_t rc, container_t container, xbt_dict_t filter)
{
- if (xbt_dict_length (rc->routing_sons)){
+ if (!xbt_dict_is_empty(rc->routing_sons)){
xbt_dict_cursor_t cursor = NULL;
AS_t rc_son;
char *child_name;
static void recursiveXBTGraphExtraction (xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges,
AS_t rc, container_t container)
{
- if (xbt_dict_length (rc->routing_sons)){
+ if (!xbt_dict_is_empty(rc->routing_sons)){
xbt_dict_cursor_t cursor = NULL;
AS_t rc_son;
char *child_name;
snprintf(aux, INSTR_DEFAULT_STR_SIZE, "%d#%d", src, dst);
xbt_dynar_t d = xbt_dict_get_or_null(keys, aux);
- xbt_assert(xbt_dynar_length(d)!=0,
+ xbt_assert(!xbt_dynar_is_empty(d),
"Trying to get a link key (for message reception) that has no corresponding send (%s).", __FUNCTION__);
char *s = xbt_dynar_get_as (d, 0, char *);
snprintf (key, n, "%s", s);
AS_t elem;
network_element_t network_elem;
- if( xbt_dict_length(current_comp->routing_sons) == 0 ) {
+ if(xbt_dict_is_empty(current_comp->routing_sons)) {
// I am no AS
// add hosts to jedule platform
xbt_dynar_t hosts;
smx_req_t req;
unsigned int iter;
- while (xbt_dynar_length(simix_global->process_to_run)) {
+ while (!xbt_dynar_is_empty(simix_global->process_to_run)) {
SIMIX_process_runall();
xbt_dynar_foreach(simix_global->process_that_ran, iter, process) {
req = &process->request;
char *evtname = NULL;
xbt_dynar_t myqueue = xbt_dict_get_or_null(action_queues, name);
- if (myqueue == NULL || xbt_dynar_length(myqueue) == 0) { // nothing stored for me. Read the file further
+ if (myqueue == NULL || xbt_dynar_is_empty(myqueue)) { // nothing stored for me. Read the file further
if (action_fp == NULL) { // File closed now. There's nothing more to read. I'm out of here
goto todo_done;
xbt_dynar_foreach(dag,count,task){
if(task->kind == SD_TASK_COMM_E2E) continue;
task->marked = 0;
- if(xbt_dynar_length(task->tasks_after) == 0){
+ if(xbt_dynar_is_empty(task->tasks_after)){
xbt_dynar_push(current, &task);
}
}
task = NULL;
count = 0;
//test if something has to be done for the next iteration
- while(xbt_dynar_length(current) != 0){
+ while(!xbt_dynar_is_empty(current)){
next = xbt_dynar_new(sizeof(SD_task_t),NULL);
//test if the current iteration is done
count_current=0;
current = xbt_dynar_new(sizeof(SD_task_t),NULL);
xbt_dynar_foreach(dag,count,task){
if(task->kind == SD_TASK_COMM_E2E) continue;
- if(xbt_dynar_length(task->tasks_before) == 0){
+ if(xbt_dynar_is_empty(task->tasks_before)){
xbt_dynar_push(current, &task);
}
}
task = NULL;
xbt_dynar_foreach(dag,count,task){
if(task->kind == SD_TASK_COMM_E2E) continue;
- if(xbt_dynar_length(task->tasks_before) == 0){
+ if(xbt_dynar_is_empty(task->tasks_before)){
task->marked = 1;
xbt_dynar_push(current, &task);
}
task = NULL;
count = 0;
//test if something has to be done for the next iteration
- while(xbt_dynar_length(current) != 0){
+ while(!xbt_dynar_is_empty(current)){
next = xbt_dynar_new(sizeof(SD_task_t),NULL);
//test if the current iteration is done
count_current=0;
unsigned int cpt1, cpt2;
SD_task_t newfile = NULL;
SD_dependency_t depbefore, depafter;
- if (xbt_dynar_length(file->tasks_before) == 0) {
+ if (xbt_dynar_is_empty(file->tasks_before)) {
xbt_dynar_foreach(file->tasks_after, cpt2, depafter) {
SD_task_t newfile =
SD_task_create_comm_e2e(file->name, NULL, file->amount);
#endif
xbt_dynar_push(result, &newfile);
}
- } else if (xbt_dynar_length(file->tasks_after) == 0) {
+ } else if (xbt_dynar_is_empty(file->tasks_after)) {
xbt_dynar_foreach(file->tasks_before, cpt2, depbefore) {
SD_task_t newfile =
SD_task_create_comm_e2e(file->name, NULL, file->amount);
unsigned int cpt1, cpt2;
SD_task_t newfile = NULL;
SD_dependency_t depbefore, depafter;
- if (xbt_dynar_length(file->tasks_before) == 0) {
+ if (xbt_dynar_is_empty(file->tasks_before)) {
xbt_dynar_foreach(file->tasks_after, cpt2, depafter) {
SD_task_t newfile =
SD_task_create_comm_e2e(file->name, NULL, file->amount);
SD_task_dependency_add(NULL, NULL, newfile, depafter->dst);
xbt_dynar_push(result, &newfile);
}
- } else if (xbt_dynar_length(file->tasks_after) == 0) {
+ } else if (xbt_dynar_is_empty(file->tasks_after)) {
xbt_dynar_foreach(file->tasks_before, cpt2, depbefore) {
SD_task_t newfile =
SD_task_create_comm_e2e(file->name, NULL, file->amount);
}
XBT_INFO(" - amount: %.0f", SD_task_get_amount(task));
XBT_INFO(" - Dependencies to satisfy: %d", task->unsatisfied_dependencies);
- if (xbt_dynar_length(task->tasks_before)) {
+ if (!xbt_dynar_is_empty(task->tasks_before)) {
XBT_INFO(" - pre-dependencies:");
xbt_dynar_foreach(task->tasks_before, counter, dependency) {
XBT_INFO(" %s", SD_task_get_name(dependency->src));
}
}
- if (xbt_dynar_length(task->tasks_after)) {
+ if (!xbt_dynar_is_empty(task->tasks_after)) {
XBT_INFO(" - post-dependencies:");
xbt_dynar_foreach(task->tasks_after, counter, dependency) {
XBT_INFO(" %s", SD_task_get_name(dependency->dst));
/* we must destroy the dependencies carefuly (with SD_dependency_remove)
because each one is stored twice */
SD_dependency_t dependency;
- while (xbt_dynar_length(task->tasks_before) > 0) {
+ while (!xbt_dynar_is_empty(task->tasks_before)) {
xbt_dynar_get_cpy(task->tasks_before, 0, &dependency);
SD_task_dependency_remove(dependency->src, dependency->dst);
}
- while (xbt_dynar_length(task->tasks_after) > 0) {
+ while (!xbt_dynar_is_empty(task->tasks_after)) {
xbt_dynar_get_cpy(task->tasks_after, 0, &dependency);
SD_task_dependency_remove(dependency->src, dependency->dst);
}
#else
static void smx_ctx_raw_runall_serial(void)
{
- if (xbt_dynar_length(simix_global->process_to_run) > 0) {
+ if (!xbt_dynar_is_empty(simix_global->process_to_run)) {
smx_process_t first_process =
xbt_dynar_get_as(simix_global->process_to_run, 0, smx_process_t);
raw_process_index = 1;
static void smx_ctx_sysv_runall_serial(void)
{
- if (xbt_dynar_length(simix_global->process_to_run) > 0) {
+ if (!xbt_dynar_is_empty(simix_global->process_to_run)) {
smx_process_t first_process =
xbt_dynar_get_as(simix_global->process_to_run, 0, smx_process_t);
smx_ctx_sysv_process_index = 1;
#ifdef TIME_BENCH
smx_ctx_raw_new_sr();
#endif
- while (xbt_dynar_length(simix_global->process_to_run)) {
+ while (!xbt_dynar_is_empty(simix_global->process_to_run)) {
XBT_DEBUG("New Sub-Schedule Round; size(queue)=%lu",
xbt_dynar_length(simix_global->process_to_run));
SIMIX_process_runall();
/* Clean processes to destroy */
SIMIX_process_empty_trash();
- } while (time != -1.0 || xbt_dynar_length(simix_global->process_to_run) > 0);
+ } while (time != -1.0 || !xbt_dynar_is_empty(simix_global->process_to_run));
if (xbt_swag_size(simix_global->process_list) != 0) {
int SIMIX_req_comm_testany(xbt_dynar_t comms)
{
smx_req_t req = SIMIX_req_mine();
- if (xbt_dynar_length(comms)==0)
+ if (xbt_dynar_is_empty(comms))
return -1;
req->call = REQ_COMM_TESTANY;
XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
/* LARGE PLATFORMS HACK:
assert on total_route_size */
- xbt_assert(xbt_dynar_length(route) || latency,
+ xbt_assert(!xbt_dynar_is_empty(route) || latency,
"You're trying to send data from %s to %s but there is no connection at all between these two hosts.",
src_name, dst_name);
bandwidth_constraint_callback(action->rate, bandwidth_bound,
size);
- if(xbt_dynar_length(route) > 0) {
+ if(!xbt_dynar_is_empty(route)) {
link = *(link_CM02_t*)xbt_dynar_get_ptr(route, 0);
gap_append(size, link, action);
XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)",
}
}
- while (xbt_dynar_length(socket_to_destroy)){
+ while (!xbt_dynar_is_empty(socket_to_destroy)){
xbt_dynar_pop(socket_to_destroy,&key);
void *data = xbt_dict_get (dict_socket, key);
unsigned int iterator;
sg_platf_AS_begin_cb_t fun;
- if (!surf_parse_models_setup_already_called && xbt_dynar_length(sg_platf_AS_begin_cb_list)) {
+ if (!surf_parse_models_setup_already_called && !xbt_dynar_is_empty(sg_platf_AS_begin_cb_list)) {
/* Initialize the surf models. That must be done after we got all config, and before we need the models.
* That is, after the last <config> tag, if any, and before the first of cluster|peer|AS|trace|trace_connect
*
xbt_assert(src_id, "Network elements %s not found", src);
xbt_assert(dst_id, "Network elements %s not found", dst);
- xbt_assert(xbt_dynar_length(route->generic_route.link_list) > 0,
+ xbt_assert(!xbt_dynar_is_empty(route->generic_route.link_list),
"Invalid count of links, must be greater than zero (%s,%s)",
src, dst);
char *route_name;
route_name = bprintf("%s#%s", src, dst);
- xbt_assert(xbt_dynar_length(e_route->generic_route.link_list) > 0,
+ xbt_assert(!xbt_dynar_is_empty(e_route->generic_route.link_list),
"Invalid count of links, must be greater than zero (%s,%s)",
src, dst);
xbt_assert(!xbt_dict_get_or_null(dict_bypassRoutes, route_name),
int erroffset;
if(!strcmp(rc->model_desc->name,"Vivaldi")){
- if(xbt_dynar_length(route->generic_route.link_list) != 0)
+ if(!xbt_dynar_is_empty(route->generic_route.link_list))
xbt_die("You can't have link_ctn with Model Vivaldi.");
}
int erroffset;
if(!strcmp(rc->model_desc->name,"Vivaldi")){
- if(xbt_dynar_length(route->generic_route.link_list) != 0)
+ if(!xbt_dynar_is_empty(route->generic_route.link_list))
xbt_die("You can't have link_ctn with Model Vivaldi.");
}
{
fflush(NULL);
XBT_INFO("ETag_surfxml_include_state '%s'",A_surfxml_include_file);
- if(xbt_dynar_length(surf_input_buffer_stack)!= 0)
+ if(!xbt_dynar_is_empty(surf_input_buffer_stack))
return 1;
fclose(surf_file_to_parse);
xbt_dynar_pop(surf_file_to_parse_stack, &surf_file_to_parse);
variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_int);
if (variable->max == 1) {
- if (variable->cb_rm && xbt_dynar_length(variable->content))
+ if (variable->cb_rm && !xbt_dynar_is_empty(variable->content))
variable->cb_rm(name, 0);
xbt_dynar_set(variable->content, 0, &val);
variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_double);
if (variable->max == 1) {
- if (variable->cb_rm && xbt_dynar_length(variable->content))
+ if (variable->cb_rm && !xbt_dynar_is_empty(variable->content))
variable->cb_rm(name, 0);
xbt_dynar_set(variable->content, 0, &val);
xbt_cfgelm_type_name[variable->type], variable->type, variable);
if (variable->max == 1) {
- if (xbt_dynar_length(variable->content)) {
+ if (!xbt_dynar_is_empty(variable->content)) {
if (variable->cb_rm)
variable->cb_rm(name, 0);
else if (variable->type == xbt_cfgelm_string) {
variable = xbt_cfgelm_get(cfg, name, xbt_cfgelm_peer);
if (variable->max == 1) {
- if (variable->cb_rm && xbt_dynar_length(variable->content))
+ if (variable->cb_rm && !xbt_dynar_is_empty(variable->content))
variable->cb_rm(name, 0);
xbt_dynar_set(variable->content, 0, &val);
XBT_WARN
("You asked for the first value of the config element '%s', but there is %lu values\n",
name, xbt_dynar_length(variable->content));
- } else if (xbt_dynar_length(variable->content) == 0) {
+ } else if (xbt_dynar_is_empty(variable->content)) {
return NULL;
}
int keys_len = xbt_dynar_length(keys);
xbt_assert(xbt_dynar_length(keys) == xbt_dynar_length(lens));
- xbt_assert(xbt_dynar_length(keys) >= 1,
+ xbt_assert(!xbt_dynar_is_empty(keys),
"Can't get a zero-long key set in a multidict");
XBT_DEBUG("xbt_multidict_get(%p, %ld)", mdict, xbt_dynar_length(keys));
"The retrieved value is not the same than the injected one (%d!=%d)",
cursor, cpt);
}
- xbt_test_assert(xbt_dynar_length(d) == 0,
+ xbt_test_assert(xbt_dynar_is_empty(d),
"There is still %lu elements in the dynar after removing everything",
xbt_dynar_length(d));
xbt_dynar_free(&d);
"The retrieved value is not the same than the injected one (%d!=%d)",
cursor, cpt);
}
- xbt_test_assert(xbt_dynar_length(d) == 0,
+ xbt_test_assert(xbt_dynar_is_empty(d),
"There is still %lu elements in the dynar after removing everything",
xbt_dynar_length(d));
xbt_dynar_free(&d);
/* split the string, and remove empty entries */
set_strings = xbt_str_split_quoted(control_string);
- if (xbt_dynar_length(set_strings) == 0) { /* vicious user! */
+ if (xbt_dynar_is_empty(set_strings)) { /* vicious user! */
xbt_dynar_free(&set_strings);
return;
}
static int _xbt_set_get_id(xbt_set_t set)
{
int id;
- if (xbt_dynar_length(set->available_ids) > 0) {
+ if (!xbt_dynar_is_empty(set->available_ids)) {
/* if there are some available ids */
xbt_dynar_pop(set->available_ids, &id);
} else {
void xbt_queue_pop(xbt_queue_t queue, void *const dst)
{
xbt_mutex_acquire(queue->mutex);
- while (xbt_dynar_length(queue->data) == 0) {
+ while (xbt_dynar_is_empty(queue->data)) {
XBT_DEBUG("Queue %p empty. Waiting", queue);
xbt_cond_wait(queue->not_empty, queue->mutex);
}
void xbt_queue_shift(xbt_queue_t queue, void *const dst)
{
xbt_mutex_acquire(queue->mutex);
- while (xbt_dynar_length(queue->data) == 0) {
+ while (xbt_dynar_is_empty(queue->data)) {
XBT_DEBUG("Queue %p empty. Waiting", queue);
xbt_cond_wait(queue->not_empty, queue->mutex);
}
xbt_mutex_acquire(queue->mutex);
if (delay == 0) {
- if (xbt_dynar_length(queue->data) == 0) {
+ if (xbt_dynar_is_empty(queue->data)) {
xbt_mutex_release(queue->mutex);
THROWF(timeout_error, 0, "Delay = 0, and queue is empty");
}
} else {
- while ((xbt_dynar_length(queue->data) == 0) &&
+ while ((xbt_dynar_is_empty(queue->data)) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
XBT_DEBUG("Queue %p empty. Waiting", queue);
TRY {
xbt_mutex_acquire(queue->mutex);
if (delay == 0) {
- if (xbt_dynar_length(queue->data) == 0) {
+ if (xbt_dynar_is_empty(queue->data)) {
xbt_mutex_release(queue->mutex);
THROWF(timeout_error, 0, "Delay = 0, and queue is empty");
}
} else {
- while ((xbt_dynar_length(queue->data) == 0) &&
+ while ((xbt_dynar_is_empty(queue->data)) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
XBT_DEBUG("Queue %p empty. Waiting", queue);
TRY {
}
}
- if (xbt_dynar_length(queue->data) == 0) {
+ if (xbt_dynar_is_empty(queue->data)) {
xbt_mutex_release(queue->mutex);
THROWF(timeout_error, 0, "Timeout (%f) elapsed, but queue still empty",
delay);
return xbt_replay_trace_reader_get(reader); /* Get next line */
d=xbt_str_split_quoted_in_place(reader->line);
- if (xbt_dynar_length(d)==0) {
+ if (xbt_dynar_is_empty(d)) {
xbt_dynar_free(&d);
return xbt_replay_trace_reader_get(reader); /* Get next line */
}
xbt_dynar_new(sizeof(worker_data_t), worker_wait_n_free);
unsigned int cursor;
void *data;
- if (xbt_dynar_length(datas) == 0)
+ if (xbt_dynar_is_empty(datas))
return; /* nothing to do */
if (xbt_dynar_length(datas) == 1) {
/* don't start any new thread, do it directly */
write_read("xbt_dynar_of_int", &i, &j, sock, direction);
/* xbt_dynar_dump(j); */
if (direction == READ || direction == COPY) {
- xbt_assert(xbt_dynar_length(j) == 0);
+ xbt_assert(xbt_dynar_is_empty(j));
xbt_dynar_free(&j);
}
xbt_dynar_free(&i);
SD_workstation_get_name(hosts[i]),
SD_workstation_get_power(hosts[i]));
props = SD_workstation_get_properties(hosts[i]);
- if (props && xbt_dict_length(props) > 0) {
+ if (props && !xbt_dict_is_empty(props)) {
printf(">\n");
xbt_dict_foreach(props, cursor, key, data) {
printf(" <prop id=\"%s\" value=\"%s\"/>\n", key, data);
XBT_INFO("Before Node deletion: %lu nodes, %lu edges",
xbt_dynar_length(nodes), xbt_dynar_length(edges));
- while (xbt_dynar_length(nodes))
+ while (!xbt_dynar_is_empty(nodes))
xbt_graph_free_node(graph,
*((xbt_node_t *) xbt_dynar_get_ptr(nodes, 0)),
free_label, NULL);
XBT_INFO("Before Edge deletion: %lu nodes, %lu edges",
xbt_dynar_length(nodes), xbt_dynar_length(edges));
- while (xbt_dynar_length(edges))
+ while (!xbt_dynar_is_empty(edges))
xbt_graph_free_edge(graph,
*((xbt_edge_t *) xbt_dynar_get_ptr(edges, 0)),
NULL);
{
/* Do not use xbt_dynar_free or it will lock the dynar, preventing armageddon
* from working */
- while (xbt_dynar_length(bg_jobs)) {
+ while (!xbt_dynar_is_empty(bg_jobs)) {
rctx_t rctx = xbt_dynar_getlast_as(bg_jobs, rctx_t);
wait_it(rctx);
xbt_dynar_pop(bg_jobs, &rctx);