From 97c17c543f9c52abc26fbf93b85fef1185f8f0af Mon Sep 17 00:00:00 2001 From: Bernd Jendrissek Date: Wed, 3 Jun 2015 01:23:52 +0200 Subject: [PATCH] Constify parameter in several functions. --- gnetlist/include/prototype.h | 22 +++++++++++----------- gnetlist/src/s_hierarchy.c | 10 +++------- gnetlist/src/s_net.c | 4 ++-- gnetlist/src/s_netattrib.c | 13 +++---------- gnetlist/src/s_traverse.c | 6 +++--- 5 files changed, 22 insertions(+), 33 deletions(-) diff --git a/gnetlist/include/prototype.h b/gnetlist/include/prototype.h index fc7cc53c4..99f51528a 100644 --- a/gnetlist/include/prototype.h +++ b/gnetlist/include/prototype.h @@ -58,9 +58,9 @@ void s_hierarchy_post_process(TOPLEVEL *pr_current, NETLIST *head); int s_hierarchy_setup_rename(TOPLEVEL *pr_current, NETLIST *head, char *uref, char *label, char *new_name); void s_hierarchy_remove_urefconn(NETLIST *head, char *uref_disable); void s_hierarchy_remove_compsite_all(NETLIST *head); -char *s_hierarchy_create_uref(TOPLEVEL *pr_current, char *basename, char *hierarchy_tag); -char *s_hierarchy_create_netname(TOPLEVEL *pr_current, char *basename, char *hierarchy_tag); -char *s_hierarchy_create_netattrib(TOPLEVEL *pr_current, char *basename, char *hierarchy_tag); +char *s_hierarchy_create_uref(TOPLEVEL *pr_current, char *basename, char const *hierarchy_tag); +char *s_hierarchy_create_netname(TOPLEVEL *pr_current, char *basename, char const *hierarchy_tag); +char *s_hierarchy_create_netattrib(TOPLEVEL *pr_current, char *basename, char const *hierarchy_tag); void s_hierarchy_remove_uref_mangling(TOPLEVEL *pr_current, NETLIST *head); char *s_hierarchy_return_baseuref(TOPLEVEL *pr_current, char *uref); int s_hierarchy_graphical_search(OBJECT* o_current, int count); @@ -71,16 +71,16 @@ void verbose_reset_index(void); /* s_net.c */ NET *s_net_add(NET *ptr); void s_net_print(NET *ptr); -char *s_net_return_connected_string(TOPLEVEL *pr_current, OBJECT *object, char *hierarchy_tag); +char *s_net_return_connected_string(TOPLEVEL *pr_current, OBJECT *object, char const *hierarchy_tag); int s_net_find(NET *net_head, NET *node); char *s_net_name_search(TOPLEVEL *pr_current, NET *net_head); -char *s_net_name(TOPLEVEL *pr_current, NETLIST *netlist, NET *net_head, char *hierarchy_tag); +char *s_net_name(TOPLEVEL *pr_current, NETLIST *netlist, NET *net_head, char const *hierarchy_tag); /* s_netattrib.c */ char *s_netattrib_extract_netname(char *value); -void s_netattrib_create_pins(TOPLEVEL *pr_current, OBJECT *o_current, NETLIST *netlist, char *value, char *hierarchy_tag); -void s_netattrib_handle(TOPLEVEL *pr_current, OBJECT *o_current, NETLIST *netlist, char *hierarchy_tag); +void s_netattrib_create_pins(TOPLEVEL *pr_current, OBJECT *o_current, NETLIST *netlist, char *value, char const *hierarchy_tag); +void s_netattrib_handle(TOPLEVEL *pr_current, OBJECT *o_current, NETLIST *netlist, char const *hierarchy_tag); char *s_netattrib_net_search(OBJECT *o_current, char *wanted_pin); -char *s_netattrib_return_netname(TOPLEVEL *pr_current, OBJECT *o_current, char *pinnumber, char *hierarchy_tag); +char *s_netattrib_return_netname(TOPLEVEL *pr_current, OBJECT *o_current, char *pinnumber, char const *hierarchy_tag); /* s_netlist.c */ NETLIST *s_netlist_return_tail(NETLIST *head); NETLIST *s_netlist_add(NETLIST *ptr); @@ -105,10 +105,10 @@ SCM g_get_renamed_nets(SCM scm_level); /* s_traverse.c */ void s_traverse_init(void); void s_traverse_start(TOPLEVEL *pr_current); -void s_traverse_sheet(TOPLEVEL *pr_current, OBJECT *o_current, char *hierarchy_tag); -CPINLIST *s_traverse_component(TOPLEVEL *pr_current, OBJECT *component, char *hierarchy_tag); +void s_traverse_sheet(TOPLEVEL *pr_current, PAGE *page, char const *hierarchy_tag); +CPINLIST *s_traverse_component(TOPLEVEL *pr_current, OBJECT *component, char const *hierarchy_tag); void s_traverse_clear_all_visited(OBJECT *object_head); -NET *s_traverse_net(TOPLEVEL *pr_current, OBJECT *previous_object, NET *nets, OBJECT *object, char *hierarchy_tag); +NET *s_traverse_net(TOPLEVEL *pr_current, OBJECT *previous_object, NET *nets, OBJECT *object, char const *hierarchy_tag); /* vams_misc.c */ SCM vams_get_attribs_list(OBJECT *object); SCM vams_get_package_attributes(SCM scm_uref); diff --git a/gnetlist/src/s_hierarchy.c b/gnetlist/src/s_hierarchy.c index 8cdba07c8..6f764eeb8 100644 --- a/gnetlist/src/s_hierarchy.c +++ b/gnetlist/src/s_hierarchy.c @@ -76,14 +76,12 @@ s_hierarchy_traverse(TOPLEVEL * pr_current, OBJECT * o_current, } while (attrib) { - /* look for source=filename,filename, ... */ pcount = 0; current_filename = u_basic_breakup_string(attrib, ',', pcount); /* loop over all filenames */ while (current_filename != NULL) { - s_log_message("Going to traverse source [%s]\n", current_filename); @@ -103,7 +101,6 @@ s_hierarchy_traverse(TOPLEVEL * pr_current, OBJECT * o_current, if (page_control == -1) { fprintf(stderr, "Could not open [%s]\n", current_filename); } else { - loaded_flag = TRUE; verbose_print("v\n"); @@ -360,7 +357,7 @@ void s_hierarchy_remove_compsite_all(NETLIST * head) } char *s_hierarchy_create_uref(TOPLEVEL * pr_current, char *basename, - char *hierarchy_tag) + char const *hierarchy_tag) { char *return_value = NULL; @@ -411,7 +408,7 @@ char *s_hierarchy_create_uref(TOPLEVEL * pr_current, char *basename, } char *s_hierarchy_create_netname(TOPLEVEL * pr_current, char *basename, - char *hierarchy_tag) + char const *hierarchy_tag) { char *return_value = NULL; @@ -468,7 +465,7 @@ char *s_hierarchy_create_netname(TOPLEVEL * pr_current, char *basename, } char *s_hierarchy_create_netattrib(TOPLEVEL * pr_current, char *basename, - char *hierarchy_tag) + char const *hierarchy_tag) { char *return_value = NULL; @@ -482,7 +479,6 @@ char *s_hierarchy_create_netattrib(TOPLEVEL * pr_current, char *basename, if (hierarchy_tag) { if (basename) { - if (pr_current->hierarchy_netattrib_separator) { switch (pr_current->hierarchy_netattrib_order) { case (APPEND): diff --git a/gnetlist/src/s_net.c b/gnetlist/src/s_net.c index 8d5210a0a..bd489a200 100644 --- a/gnetlist/src/s_net.c +++ b/gnetlist/src/s_net.c @@ -105,7 +105,7 @@ void s_net_print(NET * ptr) /* object being a pin */ char *s_net_return_connected_string(TOPLEVEL * pr_current, OBJECT * object, - char *hierarchy_tag) + char const *hierarchy_tag) { OBJECT *o_current; OBJECT *o_pinnum_object; @@ -304,7 +304,7 @@ char *s_net_name_search(TOPLEVEL * pr_current, NET * net_head) } char *s_net_name(TOPLEVEL *pr_current, NETLIST *netlist, - NET * net_head, char *hierarchy_tag) + NET * net_head, char const *hierarchy_tag) { char *string; NET *n_start; diff --git a/gnetlist/src/s_netattrib.c b/gnetlist/src/s_netattrib.c index 290cc7e52..4c439e359 100644 --- a/gnetlist/src/s_netattrib.c +++ b/gnetlist/src/s_netattrib.c @@ -76,7 +76,7 @@ char *s_netattrib_extract_netname(char *value) void s_netattrib_create_pins(TOPLEVEL * pr_current, OBJECT * o_current, NETLIST * netlist, char *value, - char *hierarchy_tag) + char const *hierarchy_tag) { NETLIST *netlist_tail = NULL; CPINLIST *cpinlist_tail = NULL; @@ -88,31 +88,26 @@ s_netattrib_create_pins(TOPLEVEL * pr_current, OBJECT * o_current, char *char_ptr = NULL; char *current_pin = NULL; - char_ptr = strchr(value, ':'); if (char_ptr == NULL) { return; } - net_name = s_netattrib_extract_netname(value); /* skip over first : */ start_of_pinlist = char_ptr + 1; current_pin = strtok(start_of_pinlist, DELIMITERS); while (current_pin) { - netlist_tail = s_netlist_return_tail(netlist); cpinlist_tail = s_cpinlist_return_tail(netlist_tail->cpins); if (netlist->component_uref) { - old_cpin = s_cpinlist_search_pin(netlist_tail->cpins, current_pin); if (old_cpin) { - if (!old_cpin->nets) { fprintf(stderr, "Ack! internal error! (s_netattrib_create_pins)\n"); @@ -137,8 +132,6 @@ s_netattrib_create_pins(TOPLEVEL * pr_current, OBJECT * o_current, old_cpin->nets->nid = o_current->sid; g_free(connected_to); } else { - - new_cpin = s_cpinlist_add(cpinlist_tail); new_cpin->pin_number = g_strdup (current_pin); @@ -179,7 +172,7 @@ s_netattrib_create_pins(TOPLEVEL * pr_current, OBJECT * o_current, void s_netattrib_handle(TOPLEVEL * pr_current, OBJECT * o_current, - NETLIST * netlist, char *hierarchy_tag) + NETLIST * netlist, char const *hierarchy_tag) { char *value; int counter = 0; @@ -337,7 +330,7 @@ char *s_netattrib_net_search(OBJECT * o_current, char *wanted_pin) } char *s_netattrib_return_netname(TOPLEVEL * pr_current, OBJECT * o_current, - char *pinnumber, char *hierarchy_tag) + char *pinnumber, char const *hierarchy_tag) { char *current_pin; char *netname; diff --git a/gnetlist/src/s_traverse.c b/gnetlist/src/s_traverse.c index eab447809..b28884ada 100644 --- a/gnetlist/src/s_traverse.c +++ b/gnetlist/src/s_traverse.c @@ -100,7 +100,7 @@ void s_traverse_start(TOPLEVEL * pr_current) void s_traverse_sheet(TOPLEVEL * pr_current, OBJECT *o_current, - char *hierarchy_tag) + char const *hierarchy_tag) { NETLIST *netlist; char *temp; @@ -207,7 +207,7 @@ s_traverse_sheet(TOPLEVEL * pr_current, OBJECT *o_current, } CPINLIST *s_traverse_component(TOPLEVEL * pr_current, OBJECT * component, - char *hierarchy_tag) + char const *hierarchy_tag) { CPINLIST *cpinlist_head = NULL; CPINLIST *cpins = NULL; @@ -351,7 +351,7 @@ void s_traverse_clear_all_visited(OBJECT * object_head) } NET *s_traverse_net(TOPLEVEL * pr_current, OBJECT * previous_object, - NET * nets, OBJECT * object, char *hierarchy_tag) + NET * nets, OBJECT * object, char const *hierarchy_tag) { OBJECT *o_current; NET *new_net; -- 2.11.4.GIT