From: Christian Heinrich Date: Wed, 8 Jun 2016 21:20:59 +0000 (+0200) Subject: [INSTR] NULL -> nullptr substitution X-Git-Tag: v3_14~1024 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/7595678501d8cee18b1b6f1e203c5a2a47ba4e51 [INSTR] NULL -> nullptr substitution I used the following command: (the '**' means recursion in ZSH) sed -i -e 's/\([^_]\s*\)NULL/\1nullptr/g' src/**/*.cpp We check for the underscore to avoid replacing MPI_*_NULL --- diff --git a/src/instr/instr_TI_trace.cpp b/src/instr/instr_TI_trace.cpp index fa32d4c56a..dfbb6a06b5 100644 --- a/src/instr/instr_TI_trace.cpp +++ b/src/instr/instr_TI_trace.cpp @@ -22,7 +22,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_TI_trace, instr_trace, "tracing event syst extern FILE *tracing_file; double prefix=0.0; -xbt_dict_t tracing_files = NULL; +xbt_dict_t tracing_files = nullptr; extern s_instr_trace_writer_t active_writer; @@ -37,7 +37,7 @@ void TRACE_TI_start(void) { char *filename = TRACE_get_filename(); tracing_file = fopen(filename, "w"); - if (tracing_file == NULL) { + if (tracing_file == nullptr) { THROWF(system_error, 1, "Tracefile %s could not be opened for writing.", filename); } @@ -61,15 +61,15 @@ void TRACE_TI_end(void) void print_TICreateContainer(paje_event_t event) { //if we are in the mode with only one file - static FILE *temp = NULL; + static FILE *temp = nullptr; - if (tracing_files == NULL) { - tracing_files = xbt_dict_new_homogeneous(NULL); + if (tracing_files == nullptr) { + tracing_files = xbt_dict_new_homogeneous(nullptr); //generate unique run id with time prefix = xbt_os_time(); } - if (!xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || temp == NULL) { + if (!xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || temp == nullptr) { char *folder_name = bprintf("%s_files", TRACE_get_filename()); char *filename = bprintf("%s/%f_%s.txt", folder_name, prefix, ((createContainer_t) event->data)->container->name); #ifdef WIN32 @@ -85,7 +85,7 @@ void print_TICreateContainer(paje_event_t event) xbt_free(filename); } - xbt_dict_set(tracing_files, ((createContainer_t) event->data)->container->name, (void *) temp, NULL); + xbt_dict_set(tracing_files, ((createContainer_t) event->data)->container->name, (void *) temp, nullptr); } void print_TIDestroyContainer(paje_event_t event) @@ -101,14 +101,14 @@ void print_TIPushState(paje_event_t event) { int i; - //char* function=NULL; - if (((pushState_t) event->data)->extra == NULL) + //char* function=nullptr; + if (((pushState_t) event->data)->extra == nullptr) return; instr_extra_data extra = (instr_extra_data) (((pushState_t) event->data)->extra); - char *process_id = NULL; + char *process_id = nullptr; //FIXME: dirty extract "rank-" from the name, as we want the bare process id here - if (strstr(((pushState_t) event->data)->container->name, "rank-") == NULL) + if (strstr(((pushState_t) event->data)->container->name, "rank-") == nullptr) process_id = xbt_strdup(((pushState_t) event->data)->container->name); else process_id = xbt_strdup(((pushState_t) event->data)->container->name + 5); @@ -220,9 +220,9 @@ void print_TIPushState(paje_event_t event) break; } - if (extra->recvcounts != NULL) + if (extra->recvcounts != nullptr) xbt_free(extra->recvcounts); - if (extra->sendcounts != NULL) + if (extra->sendcounts != nullptr) xbt_free(extra->sendcounts); xbt_free(process_id); xbt_free(extra); diff --git a/src/instr/instr_config.cpp b/src/instr/instr_config.cpp index 9d31e0791f..7305df95f1 100644 --- a/src/instr/instr_config.cpp +++ b/src/instr/instr_config.cpp @@ -87,11 +87,11 @@ static void TRACE_getopts(void) trace_precision = xbt_cfg_get_int(OPT_TRACING_PRECISION); } -static xbt_dynar_t TRACE_start_functions = NULL; +static xbt_dynar_t TRACE_start_functions = nullptr; void TRACE_add_start_function(void (*func) ()) { - if (TRACE_start_functions == NULL) - TRACE_start_functions = xbt_dynar_new(sizeof(void (*)()), NULL); + if (TRACE_start_functions == nullptr) + TRACE_start_functions = xbt_dynar_new(sizeof(void (*)()), nullptr); xbt_dynar_push(TRACE_start_functions, &func); } @@ -137,7 +137,7 @@ int TRACE_start() user_vm_variables = xbt_dict_new_homogeneous(xbt_free_f); user_link_variables = xbt_dict_new_homogeneous(xbt_free_f); - if (TRACE_start_functions != NULL) { + if (TRACE_start_functions != nullptr) { void (*func) (); unsigned int iter; xbt_dynar_foreach(TRACE_start_functions, iter, func) { @@ -149,11 +149,11 @@ int TRACE_start() return 0; } -static xbt_dynar_t TRACE_end_functions = NULL; +static xbt_dynar_t TRACE_end_functions = nullptr; void TRACE_add_end_function(void (*func) (void)) { - if (TRACE_end_functions == NULL) - TRACE_end_functions = xbt_dynar_new(sizeof(void (*)(void)), NULL); + if (TRACE_end_functions == nullptr) + TRACE_end_functions = xbt_dynar_new(sizeof(void (*)(void)), nullptr); xbt_dynar_push(TRACE_end_functions, &func); } @@ -178,7 +178,7 @@ int TRACE_end() PJ_container_release(); PJ_type_release(); - if (TRACE_end_functions != NULL) { + if (TRACE_end_functions != nullptr) { void (*func) (void); unsigned int iter; xbt_dynar_foreach(TRACE_end_functions, iter, func) { @@ -357,38 +357,38 @@ void TRACE_global_init(int *argc, char **argv) is_initialised = 1; /* name of the tracefile */ - xbt_cfg_register_string (OPT_TRACING_FILENAME, "simgrid.trace", NULL, "Trace file created by the instrumented SimGrid."); - xbt_cfg_register_boolean(OPT_TRACING, "no", NULL, "Enable Tracing."); - xbt_cfg_register_boolean(OPT_TRACING_PLATFORM, "no", NULL, "Register the platform in the trace as a hierarchy."); - xbt_cfg_register_boolean(OPT_TRACING_TOPOLOGY, "yes", NULL, "Register the platform topology in the trace as a graph."); - xbt_cfg_register_boolean(OPT_TRACING_SMPI, "no", NULL, "Tracing of the SMPI interface."); - xbt_cfg_register_boolean(OPT_TRACING_SMPI_GROUP,"no", NULL, "Group MPI processes by host."); - xbt_cfg_register_boolean(OPT_TRACING_SMPI_COMPUTING, "no", NULL, "Generate states for timing out of SMPI parts of the application"); - xbt_cfg_register_boolean(OPT_TRACING_SMPI_SLEEPING, "no", NULL, "Generate states for timing out of SMPI parts of the application"); - xbt_cfg_register_boolean(OPT_TRACING_SMPI_INTERNALS, "no", NULL, "View internal messages sent by Collective communications in SMPI"); - xbt_cfg_register_boolean(OPT_TRACING_CATEGORIZED, "no", NULL, "Tracing categorized resource utilization of hosts and links."); - xbt_cfg_register_boolean(OPT_TRACING_UNCATEGORIZED, "no", NULL, "Tracing uncategorized resource utilization of hosts and links."); - - xbt_cfg_register_boolean(OPT_TRACING_MSG_PROCESS, "no", NULL, "Tracing of MSG process behavior."); - xbt_cfg_register_boolean(OPT_TRACING_MSG_VM, "no", NULL, "Tracing of MSG process behavior."); - xbt_cfg_register_boolean(OPT_TRACING_DISABLE_LINK, "no", NULL, "Do not trace link bandwidth and latency."); - xbt_cfg_register_boolean(OPT_TRACING_DISABLE_POWER, "no", NULL, "Do not trace host power."); - xbt_cfg_register_boolean(OPT_TRACING_BUFFER, "yes", NULL, "Buffer trace events to put them in temporal order."); - - xbt_cfg_register_boolean(OPT_TRACING_ONELINK_ONLY, "no", NULL, "Use only routes with one link to trace platform."); - xbt_cfg_register_boolean(OPT_TRACING_DISABLE_DESTROY, "no", NULL, "Disable platform containers destruction."); - xbt_cfg_register_boolean(OPT_TRACING_BASIC, "no", NULL, "Avoid extended events (impoverished trace file)."); - xbt_cfg_register_boolean(OPT_TRACING_DISPLAY_SIZES, "no", NULL, "(smpi only) Extended events with message size information"); - xbt_cfg_register_string(OPT_TRACING_FORMAT, "Paje", NULL, "(smpi only) Switch the output format of Tracing"); - xbt_cfg_register_boolean(OPT_TRACING_FORMAT_TI_ONEFILE, "no", NULL, "(smpi only) For replay format only : output to one file only"); - xbt_cfg_register_string(OPT_TRACING_COMMENT, "", NULL, "Comment to be added on the top of the trace file."); - xbt_cfg_register_string(OPT_TRACING_COMMENT_FILE, "", NULL, + xbt_cfg_register_string (OPT_TRACING_FILENAME, "simgrid.trace", nullptr, "Trace file created by the instrumented SimGrid."); + xbt_cfg_register_boolean(OPT_TRACING, "no", nullptr, "Enable Tracing."); + xbt_cfg_register_boolean(OPT_TRACING_PLATFORM, "no", nullptr, "Register the platform in the trace as a hierarchy."); + xbt_cfg_register_boolean(OPT_TRACING_TOPOLOGY, "yes", nullptr, "Register the platform topology in the trace as a graph."); + xbt_cfg_register_boolean(OPT_TRACING_SMPI, "no", nullptr, "Tracing of the SMPI interface."); + xbt_cfg_register_boolean(OPT_TRACING_SMPI_GROUP,"no", nullptr, "Group MPI processes by host."); + xbt_cfg_register_boolean(OPT_TRACING_SMPI_COMPUTING, "no", nullptr, "Generate states for timing out of SMPI parts of the application"); + xbt_cfg_register_boolean(OPT_TRACING_SMPI_SLEEPING, "no", nullptr, "Generate states for timing out of SMPI parts of the application"); + xbt_cfg_register_boolean(OPT_TRACING_SMPI_INTERNALS, "no", nullptr, "View internal messages sent by Collective communications in SMPI"); + xbt_cfg_register_boolean(OPT_TRACING_CATEGORIZED, "no", nullptr, "Tracing categorized resource utilization of hosts and links."); + xbt_cfg_register_boolean(OPT_TRACING_UNCATEGORIZED, "no", nullptr, "Tracing uncategorized resource utilization of hosts and links."); + + xbt_cfg_register_boolean(OPT_TRACING_MSG_PROCESS, "no", nullptr, "Tracing of MSG process behavior."); + xbt_cfg_register_boolean(OPT_TRACING_MSG_VM, "no", nullptr, "Tracing of MSG process behavior."); + xbt_cfg_register_boolean(OPT_TRACING_DISABLE_LINK, "no", nullptr, "Do not trace link bandwidth and latency."); + xbt_cfg_register_boolean(OPT_TRACING_DISABLE_POWER, "no", nullptr, "Do not trace host power."); + xbt_cfg_register_boolean(OPT_TRACING_BUFFER, "yes", nullptr, "Buffer trace events to put them in temporal order."); + + xbt_cfg_register_boolean(OPT_TRACING_ONELINK_ONLY, "no", nullptr, "Use only routes with one link to trace platform."); + xbt_cfg_register_boolean(OPT_TRACING_DISABLE_DESTROY, "no", nullptr, "Disable platform containers destruction."); + xbt_cfg_register_boolean(OPT_TRACING_BASIC, "no", nullptr, "Avoid extended events (impoverished trace file)."); + xbt_cfg_register_boolean(OPT_TRACING_DISPLAY_SIZES, "no", nullptr, "(smpi only) Extended events with message size information"); + xbt_cfg_register_string(OPT_TRACING_FORMAT, "Paje", nullptr, "(smpi only) Switch the output format of Tracing"); + xbt_cfg_register_boolean(OPT_TRACING_FORMAT_TI_ONEFILE, "no", nullptr, "(smpi only) For replay format only : output to one file only"); + xbt_cfg_register_string(OPT_TRACING_COMMENT, "", nullptr, "Comment to be added on the top of the trace file."); + xbt_cfg_register_string(OPT_TRACING_COMMENT_FILE, "", nullptr, "The contents of the file are added to the top of the trace file as comment."); - xbt_cfg_register_int(OPT_TRACING_PRECISION, 6, NULL, "Numerical precision used when timestamping events " + xbt_cfg_register_int(OPT_TRACING_PRECISION, 6, nullptr, "Numerical precision used when timestamping events " "(expressed in number of digits after decimal point)"); /* Viva graph configuration for uncategorized tracing */ - xbt_cfg_register_string(OPT_VIVA_UNCAT_CONF, "", NULL, "Viva Graph configuration file for uncategorized resource utilization traces."); - xbt_cfg_register_string(OPT_VIVA_CAT_CONF, "", NULL, "Viva Graph configuration file for categorized resource utilization traces."); + xbt_cfg_register_string(OPT_VIVA_UNCAT_CONF, "", nullptr, "Viva Graph configuration file for uncategorized resource utilization traces."); + xbt_cfg_register_string(OPT_VIVA_CAT_CONF, "", nullptr, "Viva Graph configuration file for categorized resource utilization traces."); xbt_cfg_register_alias(OPT_TRACING_COMMENT_FILE,"tracing/comment_file"); xbt_cfg_register_alias(OPT_TRACING_DISABLE_DESTROY, "tracing/disable_destroy"); @@ -590,7 +590,7 @@ static void generate_uncat_configuration (const char *output, const char *name, { if (output && strlen(output) > 0){ FILE *file = fopen (output, "w"); - if (file == NULL){ + if (file == nullptr){ THROWF (system_error, 1, "Unable to open file (%s) for writing %s graph " "configuration (uncategorized).", output, name); } @@ -612,7 +612,7 @@ static void generate_cat_configuration (const char *output, const char *name, in } FILE *file = fopen (output, "w"); - if (file == NULL){ + if (file == nullptr){ THROWF (system_error, 1, "Unable to open file (%s) for writing %s graph " "configuration (categorized).", output, name); } diff --git a/src/instr/instr_interface.cpp b/src/instr/instr_interface.cpp index 3b7ec27783..758a2568bb 100644 --- a/src/instr/instr_interface.cpp +++ b/src/instr/instr_interface.cpp @@ -19,21 +19,21 @@ typedef enum { XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_api, instr, "API"); -xbt_dict_t created_categories = NULL; -xbt_dict_t declared_marks = NULL; -xbt_dict_t user_host_variables = NULL; -xbt_dict_t user_vm_variables = NULL; -xbt_dict_t user_link_variables = NULL; +xbt_dict_t created_categories = nullptr; +xbt_dict_t declared_marks = nullptr; +xbt_dict_t user_host_variables = nullptr; +xbt_dict_t user_vm_variables = nullptr; +xbt_dict_t user_link_variables = nullptr; extern xbt_dict_t trivaNodeTypes; extern xbt_dict_t trivaEdgeTypes; static xbt_dynar_t instr_dict_to_dynar (xbt_dict_t filter) { - if (!TRACE_is_enabled()) return NULL; - if (!TRACE_needs_platform()) return NULL; + if (!TRACE_is_enabled()) return nullptr; + if (!TRACE_needs_platform()) return nullptr; xbt_dynar_t ret = xbt_dynar_new (sizeof(char*), &xbt_free_ref); - xbt_dict_cursor_t cursor = NULL; + xbt_dict_cursor_t cursor = nullptr; char *name, *value; xbt_dict_foreach(filter, cursor, name, value) { xbt_dynar_push_as (ret, char*, xbt_strdup(name)); @@ -58,7 +58,7 @@ static xbt_dynar_t instr_dict_to_dynar (xbt_dict_t filter) */ void TRACE_category(const char *category) { - TRACE_category_with_color (category, NULL); + TRACE_category_with_color (category, nullptr); } /** \ingroup TRACE_category @@ -81,7 +81,7 @@ void TRACE_category_with_color (const char *category, const char *color) /* safe switch */ if (!TRACE_is_enabled()) return; - if (!(TRACE_categorized() && category != NULL)) return; + if (!(TRACE_categorized() && category != nullptr)) return; /* if platform is not traced, we can't deal with categories */ if (!TRACE_needs_platform()) return; @@ -89,7 +89,7 @@ void TRACE_category_with_color (const char *category, const char *color) //check if category is already created char *created = (char*)xbt_dict_get_or_null(created_categories, category); if (created) return; - xbt_dict_set (created_categories, category, xbt_strdup("1"), NULL); + xbt_dict_set (created_categories, category, xbt_strdup("1"), nullptr); //define final_color char final_color[INSTR_DEFAULT_STR_SIZE]; @@ -123,8 +123,8 @@ void TRACE_category_with_color (const char *category, const char *color) */ xbt_dynar_t TRACE_get_categories (void) { - if (!TRACE_is_enabled()) return NULL; - if (!TRACE_categorized()) return NULL; + if (!TRACE_is_enabled()) return nullptr; + if (!TRACE_categorized()) return nullptr; return instr_dict_to_dynar (created_categories); } @@ -147,7 +147,7 @@ void TRACE_declare_mark(const char *mark_type) /* if platform is not traced, we don't allow marks */ if (!TRACE_needs_platform()) return; - if (!mark_type) THROWF (tracing_error, 1, "mark_type is NULL"); + if (!mark_type) THROWF (tracing_error, 1, "mark_type is nullptr"); //check if mark_type is already declared char *created = (char*)xbt_dict_get_or_null(declared_marks, mark_type); @@ -157,7 +157,7 @@ void TRACE_declare_mark(const char *mark_type) XBT_DEBUG("MARK,declare %s", mark_type); PJ_type_event_new(mark_type, PJ_type_get_root()); - xbt_dict_set (declared_marks, mark_type, xbt_strdup("1"), NULL); + xbt_dict_set (declared_marks, mark_type, xbt_strdup("1"), nullptr); } /** \ingroup TRACE_mark @@ -166,7 +166,7 @@ void TRACE_declare_mark(const char *mark_type) * This function declares a new colored value for a Paje event type in the trace file that can be used by simulators to * declare application-level marks. This function is independent of which API is used in SimGrid. The color needs to be * a string with three numbers separated by spaces in the range [0,1]. - * A light-gray color can be specified using "0.7 0.7 0.7" as color. If a NULL color is provided, the color used will + * A light-gray color can be specified using "0.7 0.7 0.7" as color. If a nullptr color is provided, the color used will * be white ("1 1 1"). * * \param mark_type The name of the new type. @@ -183,8 +183,8 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar /* if platform is not traced, we don't allow marks */ if (!TRACE_needs_platform()) return; - if (!mark_type) THROWF (tracing_error, 1, "mark_type is NULL"); - if (!mark_value) THROWF (tracing_error, 1, "mark_value is NULL"); + if (!mark_type) THROWF (tracing_error, 1, "mark_type is nullptr"); + if (!mark_value) THROWF (tracing_error, 1, "mark_value is nullptr"); type_t type = PJ_type_get (mark_type, PJ_type_get_root()); if (!type){ @@ -203,7 +203,7 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar * * This function declares a new value for a Paje event type in the trace file that can be used by simulators to declare * application-level marks. This function is independent of which API is used in SimGrid. Calling this function is the - * same as calling \ref TRACE_declare_mark_value_with_color with a NULL color. + * same as calling \ref TRACE_declare_mark_value_with_color with a nullptr color. * * \param mark_type The name of the new type. * \param mark_value The name of the new value for this type. @@ -212,7 +212,7 @@ void TRACE_declare_mark_value_with_color (const char *mark_type, const char *mar */ void TRACE_declare_mark_value (const char *mark_type, const char *mark_value) { - TRACE_declare_mark_value_with_color (mark_type, mark_value, NULL); + TRACE_declare_mark_value_with_color (mark_type, mark_value, nullptr); } /** @@ -237,8 +237,8 @@ void TRACE_mark(const char *mark_type, const char *mark_value) /* if platform is not traced, we don't allow marks */ if (!TRACE_needs_platform()) return; - if (!mark_type) THROWF (tracing_error, 1, "mark_type is NULL"); - if (!mark_value) THROWF (tracing_error, 1, "mark_value is NULL"); + if (!mark_type) THROWF (tracing_error, 1, "mark_type is nullptr"); + if (!mark_value) THROWF (tracing_error, 1, "mark_value is nullptr"); //check if mark_type is already declared type_t type = PJ_type_get (mark_type, PJ_type_get_root()); @@ -260,7 +260,7 @@ void TRACE_mark(const char *mark_type, const char *mark_value) */ xbt_dynar_t TRACE_get_marks (void) { - if (!TRACE_is_enabled()) return NULL; + if (!TRACE_is_enabled()) return nullptr; return instr_dict_to_dynar (declared_marks); } @@ -280,7 +280,7 @@ static void instr_user_variable(double time, const char *resource, const char *v if (created){//already declared return; }else{ - xbt_dict_set (filter, variable, xbt_strdup("1"), NULL); + xbt_dict_set (filter, variable, xbt_strdup("1"), nullptr); } }else{ if (!created){//not declared, ignore @@ -332,9 +332,9 @@ static void instr_user_srcdst_variable(double time, const char *src, const char if(!dst_elm) xbt_die("Element '%s' not found!",dst); std::vector *route = new std::vector(); - routing_platf->getRouteAndLatency (src_elm, dst_elm, route,NULL); + routing_platf->getRouteAndLatency (src_elm, dst_elm, route,nullptr); for (auto link : *route) - instr_user_variable (time, link->getName(), variable, father_type, value, what, NULL, user_link_variables); + instr_user_variable (time, link->getName(), variable, father_type, value, what, nullptr, user_link_variables); delete route; } @@ -354,9 +354,9 @@ int TRACE_platform_graph_export_graphviz (const char *filename) /* returns 1 if successful, 0 otherwise */ if (!TRACE_is_enabled()) return 0; xbt_graph_t g = instr_routing_platform_graph(); - if (g == NULL) return 0; + if (g == nullptr) return 0; instr_routing_platform_graph_export_graphviz (g, filename); - xbt_graph_free_graph(g, xbt_free_f, xbt_free_f, NULL); + xbt_graph_free_graph(g, xbt_free_f, xbt_free_f, nullptr); return 1; } @@ -379,7 +379,7 @@ int TRACE_platform_graph_export_graphviz (const char *filename) */ void TRACE_vm_variable_declare (const char *variable) { - instr_user_variable(0, NULL, variable, "MSG_VM", 0, INSTR_US_DECLARE, NULL, user_vm_variables); + instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, nullptr, user_vm_variables); } /** \ingroup TRACE_user_variables @@ -394,7 +394,7 @@ void TRACE_vm_variable_declare (const char *variable) */ void TRACE_vm_variable_declare_with_color (const char *variable, const char *color) { - instr_user_variable(0, NULL, variable, "MSG_VM", 0, INSTR_US_DECLARE, color, user_vm_variables); + instr_user_variable(0, nullptr, variable, "MSG_VM", 0, INSTR_US_DECLARE, color, user_vm_variables); } /** \ingroup TRACE_user_variables @@ -456,7 +456,7 @@ void TRACE_vm_variable_sub (const char *vm, const char *variable, double value) */ void TRACE_vm_variable_set_with_time (double time, const char *vm, const char *variable, double value) { - instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SET, NULL, user_vm_variables); + instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SET, nullptr, user_vm_variables); } /** \ingroup TRACE_user_variables @@ -476,7 +476,7 @@ void TRACE_vm_variable_set_with_time (double time, const char *vm, const char *v */ void TRACE_vm_variable_add_with_time (double time, const char *vm, const char *variable, double value) { - instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_ADD, NULL, user_vm_variables); + instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_ADD, nullptr, user_vm_variables); } /** \ingroup TRACE_user_variables @@ -496,7 +496,7 @@ void TRACE_vm_variable_add_with_time (double time, const char *vm, const char *v */ void TRACE_vm_variable_sub_with_time (double time, const char *vm, const char *variable, double value) { - instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SUB, NULL, user_vm_variables); + instr_user_variable(time, vm, variable, "MSG_VM", value, INSTR_US_SUB, nullptr, user_vm_variables); } /** \ingroup TRACE_user_variables @@ -526,7 +526,7 @@ xbt_dynar_t TRACE_get_vm_variables (void) */ void TRACE_host_variable_declare (const char *variable) { - instr_user_variable(0, NULL, variable, "HOST", 0, INSTR_US_DECLARE, NULL, user_host_variables); + instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, nullptr, user_host_variables); } /** \ingroup TRACE_user_variables @@ -541,7 +541,7 @@ void TRACE_host_variable_declare (const char *variable) */ void TRACE_host_variable_declare_with_color (const char *variable, const char *color) { - instr_user_variable(0, NULL, variable, "HOST", 0, INSTR_US_DECLARE, color, user_host_variables); + instr_user_variable(0, nullptr, variable, "HOST", 0, INSTR_US_DECLARE, color, user_host_variables); } /** \ingroup TRACE_user_variables @@ -603,7 +603,7 @@ void TRACE_host_variable_sub (const char *host, const char *variable, double val */ void TRACE_host_variable_set_with_time (double time, const char *host, const char *variable, double value) { - instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SET, NULL, user_host_variables); + instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SET, nullptr, user_host_variables); } /** \ingroup TRACE_user_variables @@ -623,7 +623,7 @@ void TRACE_host_variable_set_with_time (double time, const char *host, const cha */ void TRACE_host_variable_add_with_time (double time, const char *host, const char *variable, double value) { - instr_user_variable(time, host, variable, "HOST", value, INSTR_US_ADD, NULL, user_host_variables); + instr_user_variable(time, host, variable, "HOST", value, INSTR_US_ADD, nullptr, user_host_variables); } /** \ingroup TRACE_user_variables @@ -643,7 +643,7 @@ void TRACE_host_variable_add_with_time (double time, const char *host, const cha */ void TRACE_host_variable_sub_with_time (double time, const char *host, const char *variable, double value) { - instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SUB, NULL, user_host_variables); + instr_user_variable(time, host, variable, "HOST", value, INSTR_US_SUB, nullptr, user_host_variables); } /** \ingroup TRACE_user_variables @@ -673,7 +673,7 @@ xbt_dynar_t TRACE_get_host_variables (void) */ void TRACE_link_variable_declare (const char *variable) { - instr_user_variable (0, NULL, variable, "LINK", 0, INSTR_US_DECLARE, NULL, user_link_variables); + instr_user_variable (0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, nullptr, user_link_variables); } /** \ingroup TRACE_user_variables @@ -688,7 +688,7 @@ void TRACE_link_variable_declare (const char *variable) */ void TRACE_link_variable_declare_with_color (const char *variable, const char *color) { - instr_user_variable (0, NULL, variable, "LINK", 0, INSTR_US_DECLARE, color, user_link_variables); + instr_user_variable (0, nullptr, variable, "LINK", 0, INSTR_US_DECLARE, color, user_link_variables); } /** \ingroup TRACE_user_variables @@ -750,7 +750,7 @@ void TRACE_link_variable_sub (const char *link, const char *variable, double val */ void TRACE_link_variable_set_with_time (double time, const char *link, const char *variable, double value) { - instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SET, NULL, user_link_variables); + instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SET, nullptr, user_link_variables); } /** \ingroup TRACE_user_variables @@ -770,7 +770,7 @@ void TRACE_link_variable_set_with_time (double time, const char *link, const cha */ void TRACE_link_variable_add_with_time (double time, const char *link, const char *variable, double value) { - instr_user_variable (time, link, variable, "LINK", value, INSTR_US_ADD, NULL, user_link_variables); + instr_user_variable (time, link, variable, "LINK", value, INSTR_US_ADD, nullptr, user_link_variables); } /** \ingroup TRACE_user_variables @@ -790,7 +790,7 @@ void TRACE_link_variable_add_with_time (double time, const char *link, const cha */ void TRACE_link_variable_sub_with_time (double time, const char *link, const char *variable, double value) { - instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SUB, NULL, user_link_variables); + instr_user_variable (time, link, variable, "LINK", value, INSTR_US_SUB, nullptr, user_link_variables); } /* for link variables, but with src and dst used for get_route */ @@ -977,7 +977,7 @@ void TRACE_host_set_state (const char *host, const char *state, const char *valu { container_t container = PJ_container_get(host); type_t type = PJ_type_get (state, container->type); - val_t val = PJ_value_get_or_new (value, NULL, type); /* if user didn't declare a value with a color, use NULL color */ + val_t val = PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */ new_pajeSetState(MSG_get_clock(), container, type, val); } @@ -996,7 +996,7 @@ void TRACE_host_push_state (const char *host, const char *state, const char *val { container_t container = PJ_container_get(host); type_t type = PJ_type_get (state, container->type); - val_t val = PJ_value_get_or_new (value, NULL, type); /* if user didn't declare a value with a color, use NULL color */ + val_t val = PJ_value_get_or_new (value, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */ new_pajePushState(MSG_get_clock(), container, type, val); } diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index 31f825e466..66d593e34b 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -11,10 +11,10 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_containers, instr, "Paje tracing event system (containers)"); -static container_t rootContainer = NULL; /* the root container */ -static xbt_dict_t allContainers = NULL; /* all created containers indexed by name */ -xbt_dict_t trivaNodeTypes = NULL; /* all host types defined */ -xbt_dict_t trivaEdgeTypes = NULL; /* all link types defined */ +static container_t rootContainer = nullptr; /* the root container */ +static xbt_dict_t allContainers = nullptr; /* all created containers indexed by name */ +xbt_dict_t trivaNodeTypes = nullptr; /* all host types defined */ +xbt_dict_t trivaEdgeTypes = nullptr; /* all link types defined */ long long int instr_new_paje_id (void) { @@ -24,7 +24,7 @@ long long int instr_new_paje_id (void) void PJ_container_alloc (void) { - allContainers = xbt_dict_new_homogeneous(NULL); + allContainers = xbt_dict_new_homogeneous(nullptr); trivaNodeTypes = xbt_dict_new_homogeneous(xbt_free_f); trivaEdgeTypes = xbt_dict_new_homogeneous(xbt_free_f); } @@ -43,8 +43,8 @@ void PJ_container_set_root (container_t root) container_t PJ_container_new (const char *name, e_container_types kind, container_t father) { - if (name == NULL){ - THROWF (tracing_error, 0, "can't create a container with a NULL name"); + if (name == nullptr){ + THROWF (tracing_error, 0, "can't create a container with a nullptr name"); } static long long int container_id = 0; @@ -72,7 +72,7 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe if(!newContainer->netcard) xbt_die("Element '%s' not found",name); break; default: - newContainer->netcard = NULL; + newContainer->netcard = nullptr; break; } @@ -91,11 +91,11 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe snprintf (as_typename, INSTR_DEFAULT_STR_SIZE, "L%d", newContainer->level); if (newContainer->father){ newContainer->type = PJ_type_get_or_null (as_typename, newContainer->father->type); - if (newContainer->type == NULL){ + if (newContainer->type == nullptr){ newContainer->type = PJ_type_container_new (as_typename, newContainer->father->type); } }else{ - newContainer->type = PJ_type_container_new ("0", NULL); + newContainer->type = PJ_type_container_new ("0", nullptr); } }else{ //otherwise, the name is its kind @@ -111,29 +111,29 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe default: THROWF (tracing_error, 0, "new container kind is unknown."); break; } type_t type = PJ_type_get_or_null (typeNameBuff, newContainer->father->type); - if (type == NULL){ + if (type == nullptr){ newContainer->type = PJ_type_container_new (typeNameBuff, newContainer->father->type); }else{ newContainer->type = type; } } - newContainer->children = xbt_dict_new_homogeneous(NULL); + newContainer->children = xbt_dict_new_homogeneous(nullptr); if (newContainer->father){ - xbt_dict_set(newContainer->father->children, newContainer->name, newContainer, NULL); + xbt_dict_set(newContainer->father->children, newContainer->name, newContainer, nullptr); new_pajeCreateContainer (newContainer); } //register all kinds by name - if (xbt_dict_get_or_null(allContainers, newContainer->name) != NULL){ + if (xbt_dict_get_or_null(allContainers, newContainer->name) != nullptr){ THROWF(tracing_error, 1, "container %s already present in allContainers data structure", newContainer->name); } - xbt_dict_set (allContainers, newContainer->name, newContainer, NULL); + xbt_dict_set (allContainers, newContainer->name, newContainer, nullptr); XBT_DEBUG("Add container name '%s'",newContainer->name); //register NODE types for triva configuration if (newContainer->kind == INSTR_HOST || newContainer->kind == INSTR_LINK || newContainer->kind == INSTR_ROUTER) { - xbt_dict_set (trivaNodeTypes, newContainer->type->name, xbt_strdup("1"), NULL); + xbt_dict_set (trivaNodeTypes, newContainer->type->name, xbt_strdup("1"), nullptr); } return newContainer; } @@ -141,7 +141,7 @@ container_t PJ_container_new (const char *name, e_container_types kind, containe container_t PJ_container_get (const char *name) { container_t ret = PJ_container_get_or_null (name); - if (ret == NULL){ + if (ret == nullptr){ THROWF(tracing_error, 1, "container with name %s not found", name); } return ret; @@ -149,7 +149,7 @@ container_t PJ_container_get (const char *name) container_t PJ_container_get_or_null (const char *name) { - return (container_t)(name ? xbt_dict_get_or_null(allContainers, name) : NULL); + return (container_t)(name ? xbt_dict_get_or_null(allContainers, name) : nullptr); } container_t PJ_container_get_root () @@ -159,8 +159,8 @@ container_t PJ_container_get_root () void PJ_container_remove_from_parent (container_t child) { - if (child == NULL){ - THROWF (tracing_error, 0, "can't remove from parent with a NULL child"); + if (child == nullptr){ + THROWF (tracing_error, 0, "can't remove from parent with a nullptr child"); } container_t parent = child->father; @@ -174,8 +174,8 @@ void PJ_container_remove_from_parent (container_t child) void PJ_container_free (container_t container) { - if (container == NULL){ - THROWF (tracing_error, 0, "trying to free a NULL container"); + if (container == nullptr){ + THROWF (tracing_error, 0, "trying to free a nullptr container"); } XBT_DEBUG("destroy container %s", container->name); @@ -199,16 +199,16 @@ void PJ_container_free (container_t container) xbt_free (container->id); xbt_dict_free (&container->children); xbt_free (container); - container = NULL; + container = nullptr; } static void recursiveDestroyContainer (container_t container) { - if (container == NULL){ - THROWF (tracing_error, 0, "trying to recursively destroy a NULL container"); + if (container == nullptr){ + THROWF (tracing_error, 0, "trying to recursively destroy a nullptr container"); } XBT_DEBUG("recursiveDestroyContainer %s", container->name); - xbt_dict_cursor_t cursor = NULL; + xbt_dict_cursor_t cursor = nullptr; container_t child; char *child_name; xbt_dict_foreach(container->children, cursor, child_name, child) { @@ -220,11 +220,11 @@ static void recursiveDestroyContainer (container_t container) void PJ_container_free_all () { container_t root = PJ_container_get_root(); - if (root == NULL){ - THROWF (tracing_error, 0, "trying to free all containers, but root is NULL"); + if (root == nullptr){ + THROWF (tracing_error, 0, "trying to free all containers, but root is nullptr"); } recursiveDestroyContainer (root); - rootContainer = NULL; + rootContainer = nullptr; //checks if (!xbt_dict_is_empty(allContainers)){ diff --git a/src/instr/instr_paje_trace.cpp b/src/instr/instr_paje_trace.cpp index d106f33719..4ca30af835 100644 --- a/src/instr/instr_paje_trace.cpp +++ b/src/instr/instr_paje_trace.cpp @@ -100,7 +100,7 @@ void TRACE_paje_init(void) { void TRACE_paje_start(void) { char *filename = TRACE_get_filename(); tracing_file = fopen(filename, "w"); - if (tracing_file == NULL){ + if (tracing_file == nullptr){ THROWF (system_error, 1, "Tracefile %s could not be opened for writing.", filename); } @@ -239,7 +239,7 @@ void print_pajePushState(paje_event_t event) { if (TRACE_display_sizes()) { stream << " "; - if (static_cast(event->data)->extra != NULL) { + if (static_cast(event->data)->extra != nullptr) { stream << static_cast(static_cast(event->data)->extra)->send_size; } else { @@ -254,10 +254,10 @@ void print_pajePushState(paje_event_t event) { print_row(); - if (static_cast(event->data)->extra != NULL) { - if (static_cast(static_cast(event->data)->extra)->sendcounts != NULL) + if (static_cast(event->data)->extra != nullptr) { + if (static_cast(static_cast(event->data)->extra)->sendcounts != nullptr) xbt_free(static_cast(static_cast(event->data)->extra)->sendcounts); - if (static_cast(static_cast(event->data)->extra)->recvcounts != NULL) + if (static_cast(static_cast(event->data)->extra)->recvcounts != nullptr) xbt_free(static_cast(static_cast(event->data)->extra)->recvcounts); xbt_free(static_cast(event->data)->extra); } diff --git a/src/instr/instr_paje_types.cpp b/src/instr/instr_paje_types.cpp index d9855644db..cba656d5dc 100644 --- a/src/instr/instr_paje_types.cpp +++ b/src/instr/instr_paje_types.cpp @@ -8,7 +8,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_types, instr, "Paje tracing event system (types)"); -static type_t rootType = NULL; /* the root type */ +static type_t rootType = nullptr; /* the root type */ void PJ_type_alloc () { @@ -16,7 +16,7 @@ void PJ_type_alloc () void PJ_type_release () { - rootType = NULL; + rootType = nullptr; } type_t PJ_type_get_root () @@ -26,24 +26,24 @@ type_t PJ_type_get_root () static type_t newType (const char *typeNameBuff, const char *key, const char *color, e_entity_types kind, type_t father) { - if (typeNameBuff == NULL || key == NULL){ - THROWF(tracing_error, 0, "can't create a new type with name or key equal NULL"); + if (typeNameBuff == nullptr || key == nullptr){ + THROWF(tracing_error, 0, "can't create a new type with name or key equal nullptr"); } type_t ret = xbt_new0(s_type_t, 1); ret->name = xbt_strdup (typeNameBuff); ret->father = father; ret->kind = kind; - ret->children = xbt_dict_new_homogeneous(NULL); - ret->values = xbt_dict_new_homogeneous(NULL); + ret->children = xbt_dict_new_homogeneous(nullptr); + ret->values = xbt_dict_new_homogeneous(nullptr); ret->color = xbt_strdup (color); char str_id[INSTR_DEFAULT_STR_SIZE]; snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id()); ret->id = xbt_strdup (str_id); - if (father != NULL){ - xbt_dict_set (father->children, key, ret, NULL); + if (father != nullptr){ + xbt_dict_set (father->children, key, ret, nullptr); XBT_DEBUG("new type %s, child of %s", typeNameBuff, father->name); } return ret; @@ -53,7 +53,7 @@ void PJ_type_free (type_t type) { val_t value; char *value_name; - xbt_dict_cursor_t cursor = NULL; + xbt_dict_cursor_t cursor = nullptr; xbt_dict_foreach(type->values, cursor, value_name, value) { PJ_value_free (value); } @@ -63,13 +63,13 @@ void PJ_type_free (type_t type) xbt_free (type->color); xbt_dict_free (&type->children); xbt_free (type); - type = NULL; + type = nullptr; } static void recursiveDestroyType (type_t type) { XBT_DEBUG("recursiveDestroyType %s", type->name); - xbt_dict_cursor_t cursor = NULL; + xbt_dict_cursor_t cursor = nullptr; type_t child; char *child_name; xbt_dict_foreach(type->children, cursor, child_name, child) { @@ -81,13 +81,13 @@ static void recursiveDestroyType (type_t type) void PJ_type_free_all (void) { recursiveDestroyType (PJ_type_get_root()); - rootType = NULL; + rootType = nullptr; } type_t PJ_type_get (const char *name, type_t father) { type_t ret = PJ_type_get_or_null (name, father); - if (ret == NULL){ + if (ret == nullptr){ THROWF (tracing_error, 2, "type with name (%s) not found in father type (%s)", name, father->name); } return ret; @@ -95,17 +95,17 @@ type_t PJ_type_get (const char *name, type_t father) type_t PJ_type_get_or_null (const char *name, type_t father) { - if (name == NULL || father == NULL){ - THROWF (tracing_error, 0, "can't get type with a NULL name or from a NULL father"); + if (name == nullptr || father == nullptr){ + THROWF (tracing_error, 0, "can't get type with a nullptr name or from a nullptr father"); } - type_t ret = NULL; + type_t ret = nullptr; type_t child; char *child_name; - xbt_dict_cursor_t cursor = NULL; + xbt_dict_cursor_t cursor = nullptr; xbt_dict_foreach(father->children, cursor, child_name, child) { if (strcmp (child->name, name) == 0){ - if (ret != NULL){ + if (ret != nullptr){ THROWF (tracing_error, 0, "there are two children types with the same name?"); }else{ ret = child; @@ -117,14 +117,14 @@ type_t PJ_type_get_or_null (const char *name, type_t father) type_t PJ_type_container_new (const char *name, type_t father) { - if (name == NULL){ - THROWF (tracing_error, 0, "can't create a container type with a NULL name"); + if (name == nullptr){ + THROWF (tracing_error, 0, "can't create a container type with a nullptr name"); } - type_t ret = NULL; + type_t ret = nullptr; - ret = newType (name, name, NULL, TYPE_CONTAINER, father); - if (father == NULL){ + ret = newType (name, name, nullptr, TYPE_CONTAINER, father); + if (father == nullptr){ rootType = ret; } @@ -137,11 +137,11 @@ type_t PJ_type_container_new (const char *name, type_t father) type_t PJ_type_event_new (const char *name, type_t father) { - if (name == NULL){ - THROWF (tracing_error, 0, "can't create an event type with a NULL name"); + if (name == nullptr){ + THROWF (tracing_error, 0, "can't create an event type with a nullptr name"); } - type_t ret = newType (name, name, NULL, TYPE_EVENT, father); + type_t ret = newType (name, name, nullptr, TYPE_EVENT, father); XBT_DEBUG("EventType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id); new_pajeDefineEventType(ret); return ret; @@ -149,11 +149,11 @@ type_t PJ_type_event_new (const char *name, type_t father) type_t PJ_type_variable_new (const char *name, const char *color, type_t father) { - if (name == NULL){ - THROWF (tracing_error, 0, "can't create a variable type with a NULL name"); + if (name == nullptr){ + THROWF (tracing_error, 0, "can't create a variable type with a nullptr name"); } - type_t ret = NULL; + type_t ret = nullptr; char white[INSTR_DEFAULT_STR_SIZE] = "1 1 1"; if (!color){ @@ -168,15 +168,15 @@ type_t PJ_type_variable_new (const char *name, const char *color, type_t father) type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest) { - if (name == NULL){ - THROWF (tracing_error, 0, "can't create a link type with a NULL name"); + if (name == nullptr){ + THROWF (tracing_error, 0, "can't create a link type with a nullptr name"); } - type_t ret = NULL; + type_t ret = nullptr; char key[INSTR_DEFAULT_STR_SIZE]; snprintf (key, INSTR_DEFAULT_STR_SIZE, "%s-%s-%s", name, source->id, dest->id); - ret = newType (name, key, NULL, TYPE_LINK, father); + ret = newType (name, key, nullptr, TYPE_LINK, father); XBT_DEBUG("LinkType %s(%s), child of %s(%s) %s(%s)->%s(%s)", ret->name, ret->id, father->name, father->id, source->name, source->id, dest->name, dest->id); new_pajeDefineLinkType(ret, source, dest); @@ -185,13 +185,13 @@ type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t type_t PJ_type_state_new (const char *name, type_t father) { - if (name == NULL){ - THROWF (tracing_error, 0, "can't create a state type with a NULL name"); + if (name == nullptr){ + THROWF (tracing_error, 0, "can't create a state type with a nullptr name"); } - type_t ret = NULL; + type_t ret = nullptr; - ret = newType (name, name, NULL, TYPE_STATE, father); + ret = newType (name, name, nullptr, TYPE_STATE, father); XBT_DEBUG("StateType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id); new_pajeDefineStateType(ret); return ret; diff --git a/src/instr/instr_paje_values.cpp b/src/instr/instr_paje_values.cpp index 50de8f8183..7936286965 100644 --- a/src/instr/instr_paje_values.cpp +++ b/src/instr/instr_paje_values.cpp @@ -10,8 +10,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_values, instr, "Paje tracing event s val_t PJ_value_new (const char *name, const char *color, type_t father) { - if (name == NULL || father == NULL){ - THROWF (tracing_error, 0, "can't create a value with a NULL name (or a NULL father)"); + if (name == nullptr || father == nullptr){ + THROWF (tracing_error, 0, "can't create a value with a nullptr name (or a nullptr father)"); } val_t ret = xbt_new0(s_val_t, 1); @@ -23,7 +23,7 @@ val_t PJ_value_new (const char *name, const char *color, type_t father) snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id()); ret->id = xbt_strdup (str_id); - xbt_dict_set (father->values, name, ret, NULL); + xbt_dict_set (father->values, name, ret, nullptr); XBT_DEBUG("new value %s, child of %s", ret->name, ret->father->name); new_pajeDefineEntityValue(ret); return ret; @@ -45,14 +45,14 @@ val_t PJ_value_get_or_new (const char *name, const char *color, type_t father) val_t PJ_value_get (const char *name, type_t father) { - if (name == NULL || father == NULL){ - THROWF (tracing_error, 0, "can't get a value with a NULL name (or a NULL father)"); + if (name == nullptr || father == nullptr){ + THROWF (tracing_error, 0, "can't get a value with a nullptr name (or a nullptr father)"); } if (father->kind == TYPE_VARIABLE) THROWF(tracing_error, 0, "variables can't have different values (%s)", father->name); val_t ret = (val_t)xbt_dict_get_or_null (father->values, name); - if (ret == NULL) { + if (ret == nullptr) { THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name, father->name); } return ret; diff --git a/src/instr/instr_resource_utilization.cpp b/src/instr/instr_resource_utilization.cpp index 42012ec37f..70137b6438 100644 --- a/src/instr/instr_resource_utilization.cpp +++ b/src/instr/instr_resource_utilization.cpp @@ -30,7 +30,7 @@ static void __TRACE_surf_check_variable_set_to_zero(double now, const char *vari container_t container = PJ_container_get (resource); type_t type = PJ_type_get (variable, container->type); new_pajeSetVariable (now, container, type, 0); - xbt_dict_set(platform_variables, key, (char*)"", NULL); + xbt_dict_set(platform_variables, key, (char*)"", nullptr); } xbt_free(key); } @@ -107,7 +107,7 @@ void TRACE_surf_host_set_utilization(const char *resource, const char *category, void TRACE_surf_resource_utilization_alloc() { - platform_variables = xbt_dict_new_homogeneous(NULL); + platform_variables = xbt_dict_new_homogeneous(nullptr); } void TRACE_surf_resource_utilization_release() diff --git a/src/instr/instr_trace.cpp b/src/instr/instr_trace.cpp index e5ebbf2a3c..8f6e251fc7 100644 --- a/src/instr/instr_trace.cpp +++ b/src/instr/instr_trace.cpp @@ -11,7 +11,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_trace, instr, "tracing event system"); -FILE *tracing_file = NULL; +FILE *tracing_file = nullptr; void print_NULL(paje_event_t event){} @@ -26,7 +26,7 @@ s_instr_trace_writer_t active_writer = { print_NULL, print_NULL }; -xbt_dynar_t buffer = NULL; +xbt_dynar_t buffer = nullptr; void dump_comment (const char *comment) { @@ -58,7 +58,7 @@ void dump_comment_file (const char *filename) void TRACE_init() { - buffer = xbt_dynar_new(sizeof(paje_event_t), NULL); + buffer = xbt_dynar_new(sizeof(paje_event_t), nullptr); } void TRACE_finalize() @@ -80,7 +80,7 @@ void TRACE_paje_dump_buffer (int force) event->free (event); } xbt_dynar_free (&buffer); - buffer = xbt_dynar_new (sizeof(paje_event_t), NULL); + buffer = xbt_dynar_new (sizeof(paje_event_t), nullptr); }else{ paje_event_t event; unsigned int cursor; diff --git a/src/instr/jedule/jedule_events.cpp b/src/instr/jedule/jedule_events.cpp index 64dc9dd63b..2c63914e95 100644 --- a/src/instr/jedule/jedule_events.cpp +++ b/src/instr/jedule/jedule_events.cpp @@ -22,7 +22,7 @@ void jed_event_add_resources(jed_event_t event, xbt_dynar_t host_selection) { jed_res_subset_t res_set; unsigned int i; - resource_subset_list = xbt_dynar_new(sizeof(jed_res_subset_t), NULL); + resource_subset_list = xbt_dynar_new(sizeof(jed_res_subset_t), nullptr); jed_simgrid_get_resource_selection_by_hosts(resource_subset_list, host_selection); xbt_dynar_foreach(resource_subset_list, i, res_set) { @@ -33,18 +33,18 @@ void jed_event_add_resources(jed_event_t event, xbt_dynar_t host_selection) { } void jed_event_add_characteristic(jed_event_t event, char *characteristic) { - xbt_assert( characteristic != NULL ); + xbt_assert( characteristic != nullptr ); xbt_dynar_push(event->characteristics_list, &characteristic); } void jed_event_add_info(jed_event_t event, char *key, char *value) { char *val_cp; - xbt_assert(key != NULL); - xbt_assert(value != NULL); + xbt_assert(key != nullptr); + xbt_assert(value != nullptr); val_cp = strdup(value); - xbt_dict_set(event->info_hash, key, val_cp, NULL); + xbt_dict_set(event->info_hash, key, val_cp, nullptr); } void create_jed_event(jed_event_t *event, char *name, double start_time, @@ -59,8 +59,8 @@ void create_jed_event(jed_event_t *event, char *name, double start_time, (*event)->type = xbt_strdup(type); (*event)->resource_subsets = xbt_dynar_new(sizeof(jed_res_subset_t), xbt_free_ref); - (*event)->characteristics_list = xbt_dynar_new(sizeof(char*), NULL); - (*event)->info_hash = xbt_dict_new_homogeneous(NULL); + (*event)->characteristics_list = xbt_dynar_new(sizeof(char*), nullptr); + (*event)->info_hash = xbt_dict_new_homogeneous(nullptr); } void jed_event_free(jed_event_t event) { diff --git a/src/instr/jedule/jedule_output.cpp b/src/instr/jedule/jedule_output.cpp index 165772168f..2b28d09404 100644 --- a/src/instr/jedule/jedule_output.cpp +++ b/src/instr/jedule/jedule_output.cpp @@ -24,11 +24,11 @@ xbt_dynar_t jedule_event_list; static FILE *jed_file; static void get_hierarchy_list(xbt_dynar_t hier_list, jed_simgrid_container_t container) { - xbt_assert( container != NULL ); + xbt_assert( container != nullptr ); - if( container->parent != NULL ) { + if( container->parent != nullptr ) { - if( container->parent->container_children == NULL ) { + if( container->parent->container_children == nullptr ) { // we are in the last level get_hierarchy_list(hier_list, container->parent); } else { @@ -62,7 +62,7 @@ static void get_hierarchy_string(jed_simgrid_container_t container, char *outbuf unsigned int length; outbuf[0] = '\0'; - hier_list = xbt_dynar_new(sizeof(int), NULL); + hier_list = xbt_dynar_new(sizeof(int), nullptr); get_hierarchy_list(hier_list, container); length = xbt_dynar_length(hier_list); @@ -80,10 +80,10 @@ static void get_hierarchy_string(jed_simgrid_container_t container, char *outbuf } static void print_key_value_dict(xbt_dict_t key_value_dict) { - xbt_dict_cursor_t cursor=NULL; + xbt_dict_cursor_t cursor=nullptr; char *key,*data; - if( key_value_dict != NULL ) { + if( key_value_dict != nullptr ) { xbt_dict_foreach(key_value_dict,cursor,key,data) { fprintf(jed_file, " \n",key,data); } @@ -95,7 +95,7 @@ static void print_resources(jed_simgrid_container_t resource_parent) { unsigned int i; char *res_name; char resid[STR_BUF_SIZE]; - xbt_assert( resource_parent->resource_list != NULL ); + xbt_assert( resource_parent->resource_list != nullptr ); res_nb = xbt_dynar_length(resource_parent->resource_list); @@ -115,10 +115,10 @@ static void print_container(jed_simgrid_container_t container) { unsigned int i; jed_simgrid_container_t child_container; - xbt_assert( container != NULL ); + xbt_assert( container != nullptr ); fprintf(jed_file, " \n", container->name); - if( container->container_children != NULL ) { + if( container->container_children != nullptr ) { xbt_dynar_foreach(container->container_children, i, child_container) { print_container(child_container); } @@ -138,8 +138,8 @@ static void print_event(jed_event_t event) { unsigned int i; jed_res_subset_t subset; - xbt_assert( event != NULL ); - xbt_assert( event->resource_subsets != NULL ); + xbt_assert( event != nullptr ); + xbt_assert( event->resource_subsets != nullptr ); fprintf(jed_file, " \n"); @@ -229,7 +229,7 @@ void jedule_cleanup_output() { } void jedule_store_event(jed_event_t event) { - xbt_assert(event != NULL); + xbt_assert(event != nullptr); xbt_dynar_push(jedule_event_list, &event); } #endif diff --git a/src/instr/jedule/jedule_platform.cpp b/src/instr/jedule/jedule_platform.cpp index 90a2c497b4..dfa912973a 100644 --- a/src/instr/jedule/jedule_platform.cpp +++ b/src/instr/jedule/jedule_platform.cpp @@ -26,7 +26,7 @@ static void jed_free_container(jed_simgrid_container_t container) { xbt_dict_free(&container->name2id); xbt_dynar_free(&container->resource_list); - if( container->container_children != NULL ) { + if( container->container_children != nullptr ) { unsigned int iter; jed_simgrid_container_t child_container; xbt_dynar_foreach(container->container_children, iter, child_container) { @@ -40,20 +40,20 @@ static void jed_free_container(jed_simgrid_container_t container) { void jed_simgrid_create_container(jed_simgrid_container_t *container, const char *name) { - xbt_assert( name != NULL ); + xbt_assert( name != nullptr ); *container = xbt_new0(s_jed_simgrid_container_t,1); (*container)->name = xbt_strdup(name); (*container)->is_lowest = 0; - (*container)->container_children = xbt_dynar_new(sizeof(jed_simgrid_container_t), NULL); - (*container)->parent = NULL; + (*container)->container_children = xbt_dynar_new(sizeof(jed_simgrid_container_t), nullptr); + (*container)->parent = nullptr; - xbt_dict_set(container_name2container, (*container)->name, *container, NULL); + xbt_dict_set(container_name2container, (*container)->name, *container, nullptr); } void jed_simgrid_add_container(jed_simgrid_container_t parent, jed_simgrid_container_t child) { - xbt_assert(parent != NULL); - xbt_assert(child != NULL); + xbt_assert(parent != nullptr); + xbt_assert(child != nullptr); xbt_dynar_push(parent->container_children, &child); child->parent = parent; } @@ -65,18 +65,18 @@ void jed_simgrid_add_resources(jed_simgrid_container_t parent, xbt_dynar_t host_ parent->is_lowest = 1; xbt_dynar_free(&parent->container_children); - parent->container_children = NULL; + parent->container_children = nullptr; parent->name2id = xbt_dict_new_homogeneous(xbt_free_f); parent->last_id = 0; - parent->resource_list = xbt_dynar_new(sizeof(char *), NULL); + parent->resource_list = xbt_dynar_new(sizeof(char *), nullptr); xbt_dynar_sort_strings(host_names); xbt_dynar_foreach(host_names, iter, host_name) { buf = bprintf("%d", parent->last_id); (parent->last_id)++; - xbt_dict_set(parent->name2id, host_name, buf, NULL); - xbt_dict_set(host2_simgrid_parent_container, host_name, parent, NULL); + xbt_dict_set(parent->name2id, host_name, buf, nullptr); + xbt_dict_set(host2_simgrid_parent_container, host_name, parent, nullptr); xbt_dynar_push(parent->resource_list, &host_name); } } @@ -84,8 +84,8 @@ void jed_simgrid_add_resources(jed_simgrid_container_t parent, xbt_dynar_t host_ static void add_subset_to(xbt_dynar_t subset_list, int start, int end, jed_simgrid_container_t parent) { jed_res_subset_t subset; - xbt_assert( subset_list != NULL ); - xbt_assert( parent != NULL ); + xbt_assert( subset_list != nullptr ); + xbt_assert( parent != nullptr ); subset = xbt_new0(s_jed_res_subset_t,1); subset->start_idx = start; @@ -108,16 +108,16 @@ static void add_subsets_to(xbt_dynar_t subset_list, xbt_dynar_t hostgroup, jed_s // compact ids // create subset for each id group - xbt_assert( host2_simgrid_parent_container != NULL ); - xbt_assert( subset_list != NULL ); - xbt_assert( hostgroup != NULL ); - xbt_assert( parent != NULL ); + xbt_assert( host2_simgrid_parent_container != nullptr ); + xbt_assert( subset_list != nullptr ); + xbt_assert( hostgroup != nullptr ); + xbt_assert( parent != nullptr ); - id_list = xbt_dynar_new(sizeof(char *), NULL); + id_list = xbt_dynar_new(sizeof(char *), nullptr); xbt_dynar_foreach(hostgroup, iter, host_name) { jed_simgrid_container_t parent; - xbt_assert( host_name != NULL ); + xbt_assert( host_name != nullptr ); parent = (jed_simgrid_container_t)xbt_dict_get(host2_simgrid_parent_container, host_name); id_str = (char*)xbt_dict_get(parent->name2id, host_name); xbt_dynar_push(id_list, &id_str); @@ -164,9 +164,9 @@ void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, xbt_dy unsigned int iter; xbt_dict_t parent2hostgroup; // group hosts by parent - parent2hostgroup = xbt_dict_new_homogeneous(NULL); + parent2hostgroup = xbt_dict_new_homogeneous(nullptr); - xbt_assert( host_names != NULL ); + xbt_assert( host_names != nullptr ); // for each host name // find parent container @@ -174,18 +174,18 @@ void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, xbt_dy xbt_dynar_foreach(host_names, iter, host_name) { jed_simgrid_container_t parent = (jed_simgrid_container_t)xbt_dict_get(host2_simgrid_parent_container, host_name); - xbt_assert( parent != NULL ); + xbt_assert( parent != nullptr ); xbt_dynar_t hostgroup = (xbt_dynar_t)xbt_dict_get_or_null (parent2hostgroup, parent->name); - if( hostgroup == NULL ) { - hostgroup = xbt_dynar_new(sizeof(char*), NULL); - xbt_dict_set(parent2hostgroup, parent->name, hostgroup, NULL); + if( hostgroup == nullptr ) { + hostgroup = xbt_dynar_new(sizeof(char*), nullptr); + xbt_dict_set(parent2hostgroup, parent->name, hostgroup, nullptr); } xbt_dynar_push(hostgroup, &host_name); } - xbt_dict_cursor_t cursor=NULL; + xbt_dict_cursor_t cursor=nullptr; char *parent_name; xbt_dynar_t hostgroup; jed_simgrid_container_t parent; @@ -202,18 +202,18 @@ void jed_simgrid_get_resource_selection_by_hosts(xbt_dynar_t subset_list, xbt_dy void jedule_add_meta_info(jedule_t jedule, char *key, char *value) { char *val_cp; - xbt_assert(key != NULL); - xbt_assert(value != NULL); + xbt_assert(key != nullptr); + xbt_assert(value != nullptr); val_cp = xbt_strdup(value); - xbt_dict_set(jedule->jedule_meta_info, key, val_cp, NULL); + xbt_dict_set(jedule->jedule_meta_info, key, val_cp, nullptr); } void jed_create_jedule(jedule_t *jedule) { *jedule = xbt_new0(s_jedule_t,1); - host2_simgrid_parent_container = xbt_dict_new_homogeneous(NULL); - container_name2container = xbt_dict_new_homogeneous(NULL); - (*jedule)->jedule_meta_info = xbt_dict_new_homogeneous(NULL); + host2_simgrid_parent_container = xbt_dict_new_homogeneous(nullptr); + container_name2container = xbt_dict_new_homogeneous(nullptr); + (*jedule)->jedule_meta_info = xbt_dict_new_homogeneous(nullptr); } void jed_free_jedule(jedule_t jedule) { diff --git a/src/instr/jedule/jedule_sd_binding.cpp b/src/instr/jedule/jedule_sd_binding.cpp index 542fa68f22..58f556dfe9 100644 --- a/src/instr/jedule/jedule_sd_binding.cpp +++ b/src/instr/jedule/jedule_sd_binding.cpp @@ -34,9 +34,9 @@ void jedule_log_sd_event(SD_task_t task) { jed_event_t event; - xbt_assert(task != NULL); + xbt_assert(task != nullptr); - xbt_dynar_t host_list = xbt_dynar_new(sizeof(char*), NULL); + xbt_dynar_t host_list = xbt_dynar_new(sizeof(char*), nullptr); for(int i=0; ihost_count; i++) { const char *hostname = sg_host_get_name(task->host_list[i]); @@ -53,7 +53,7 @@ void jedule_log_sd_event(SD_task_t task) static void create_hierarchy(AS_t current_comp, jed_simgrid_container_t current_container) { - xbt_dict_cursor_t cursor = NULL; + xbt_dict_cursor_t cursor = nullptr; char *key; AS_t elem; xbt_dict_t routing_sons = current_comp->children(); @@ -66,7 +66,7 @@ static void create_hierarchy(AS_t current_comp, jed_simgrid_container_t current_ unsigned int dynar_cursor; sg_host_t host_elem; - hosts = xbt_dynar_new(sizeof(char*), NULL); + hosts = xbt_dynar_new(sizeof(char*), nullptr); xbt_dynar_foreach(table, dynar_cursor, host_elem) { xbt_dynar_push_as(hosts, const char*, sg_host_get_name(host_elem)); @@ -114,7 +114,7 @@ void jedule_sd_exit(void) { if (jedule) { jed_free_jedule(jedule); - jedule = NULL; + jedule = nullptr; } } @@ -131,7 +131,7 @@ void jedule_sd_dump(const char * filename) fh = fopen(fname, "w"); - write_jedule_output(fh, jedule, jedule_event_list, NULL); + write_jedule_output(fh, jedule, jedule_event_list, nullptr); fclose(fh); free(fname);