[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gEDA-dev: [PATCH 14/24] Use o_attrib_get_name_value() to parseattribute strings in gattrib.



Replaced u_basic_breakup_string() with o_attrib_get_name_value() in
gattrib when splitting attribute string for name and/or value.
---
 gattrib/src/s_attrib.c     |    2 +-
 gattrib/src/s_object.c     |    4 ++--
 gattrib/src/s_sheet_data.c |    5 ++---
 gattrib/src/s_table.c      |    9 +++------
 gattrib/src/s_toplevel.c   |    9 ++++-----
 5 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/gattrib/src/s_attrib.c b/gattrib/src/s_attrib.c
index 289305b..cf4559f 100644
--- a/gattrib/src/s_attrib.c
+++ b/gattrib/src/s_attrib.c
@@ -52,7 +52,7 @@ int s_attrib_name_in_list(STRING_LIST *name_value_list, char *name)
 
   local_list_item = name_value_list;
   while (local_list_item != NULL) {
-    local_name =  u_basic_breakup_string(local_list_item->data, '=', 0);
+    o_attrib_get_name_value(local_list_item->data, &local_name, NULL);
     if (strcmp(local_name, name) == 0) {
       return TRUE;
     }
diff --git a/gattrib/src/s_object.c b/gattrib/src/s_object.c
index eec70bc..547f34c 100644
--- a/gattrib/src/s_object.c
+++ b/gattrib/src/s_object.c
@@ -161,7 +161,7 @@ void s_object_replace_attrib_in_object(OBJECT *o_current,
       
       /* may need to check more thoroughly here. . . . */
       old_attrib_text = g_strdup(a_current->object->text->string);
-      old_attrib_name = u_basic_breakup_string(old_attrib_text, '=', 0);
+      o_attrib_get_name_value(old_attrib_text, &old_attrib_name, NULL);
       
       if (strcmp(old_attrib_name, new_attrib_name) == 0) {
 	/* create attrib=value text string & stuff it back into pr_current */
@@ -214,7 +214,7 @@ void s_object_remove_attrib_in_object(OBJECT *o_current, char *new_attrib_name)
       
       /* may need to check more thoroughly here. . . . */
       old_attrib_text = g_strdup(a_current->object->text->string);
-      old_attrib_name = u_basic_breakup_string(old_attrib_text, '=', 0);
+      o_attrib_get_name_value(old_attrib_text, &old_attrib_name, NULL);
       
       if (strcmp(old_attrib_name, new_attrib_name) == 0) {
 	/* We've found the attrib.  Delete it and then return. */
diff --git a/gattrib/src/s_sheet_data.c b/gattrib/src/s_sheet_data.c
index 9ba33ef..7fcdad9 100644
--- a/gattrib/src/s_sheet_data.c
+++ b/gattrib/src/s_sheet_data.c
@@ -201,7 +201,7 @@ void s_sheet_data_add_master_comp_attrib_list_items(OBJECT *start_obj) {
 	  if (a_current->object->type == OBJ_TEXT 
 	      && a_current->object->text != NULL) {  /* found an attribute */
 	    attrib_text = g_strdup(a_current->object->text->string);
-	    attrib_name = u_basic_breakup_string(attrib_text, '=', 0);
+	    o_attrib_get_name_value(attrib_text, &attrib_name, NULL);
 
 	      /* Don't include "refdes" or "slot" because they form the row name */
 	      /* Also don't include "net" per bug found by Steve W. -- 4.3.2007, SDB */
@@ -408,8 +408,7 @@ void s_sheet_data_add_master_pin_attrib_list_items(OBJECT *start_obj) {
 		if (pin_attrib->object->type == OBJ_TEXT 
 		    && pin_attrib->object->text != NULL) {  /* found an attribute */
 		  attrib_text = g_strdup(pin_attrib->object->text->string);
-		  attrib_name = u_basic_breakup_string(attrib_text, '=', 0);
-		  attrib_value = s_misc_remaining_string(attrib_text, '=', 1);
+		  o_attrib_get_name_value(attrib_text, &attrib_name, &attrib_value);
 		  if ( (strcmp(attrib_name, "pinnumber") != 0) 
 		       && (attrib_value != NULL) ) {  
 		    /* Don't include "pinnumber" because it is already in other master list.
diff --git a/gattrib/src/s_table.c b/gattrib/src/s_table.c
index d89bf68..1807471 100644
--- a/gattrib/src/s_table.c
+++ b/gattrib/src/s_table.c
@@ -284,8 +284,7 @@ void s_table_add_toplevel_comp_items_to_comp_table(OBJECT *start_obj) {
               && a_current->object->text != NULL) {  /* found an attribute */
             /* may need to check more thoroughly here. . . . */
             attrib_text = g_strdup(a_current->object->text->string);
-            attrib_name = u_basic_breakup_string(attrib_text, '=', 0);
-            attrib_value = s_misc_remaining_string(attrib_text, '=', 1);
+            o_attrib_get_name_value(attrib_text, &attrib_name, &attrib_value);
 	    old_visibility = a_current->object->visibility;
 	    old_show_name_value = a_current->object->show_name_value;
 
@@ -368,8 +367,7 @@ void s_table_add_toplevel_net_items_to_net_table(OBJECT *start_obj) {
             && a_current->object->text != NULL) {  /* found an attribute */
           /* may need to check more thoroughly here. . . . */
           attrib_text = g_strdup(a_current->object->text->string);
-          attrib_name = u_basic_breakup_string(attrib_text, '=', 0);
-          attrib_value = s_misc_remaining_string(attrib_text, '=', 1);
+          o_attrib_get_name_value(attrib_text, &attrib_name, &attrib_value);
           if (strcmp(attrib_name, "netname") != 0) {
             /* Don't include "netname" */
              
@@ -480,8 +478,7 @@ void s_table_add_toplevel_pin_items_to_pin_table(OBJECT *start_obj) {
 	      if (pin_attrib->object->type == OBJ_TEXT
 		  && pin_attrib->object->text != NULL) {  /* found an attribute */
 		attrib_text = g_strdup(pin_attrib->object->text->string);
-		attrib_name = u_basic_breakup_string(attrib_text, '=', 0);
-		attrib_value = s_misc_remaining_string(attrib_text, '=', 1);
+		o_attrib_get_name_value(attrib_text, &attrib_name, &attrib_value);
  
 		if ( (strcmp(attrib_name, "pinnumber") != 0) 
 		     && (attrib_value != 0) ) {
diff --git a/gattrib/src/s_toplevel.c b/gattrib/src/s_toplevel.c
index f1e9046..4608d43 100644
--- a/gattrib/src/s_toplevel.c
+++ b/gattrib/src/s_toplevel.c
@@ -630,7 +630,7 @@ void s_toplevel_update_component_attribs_in_toplevel(OBJECT *o_current,
 
       /* Else clause is suggestion from Ales */
 #if 1
-      old_attrib_name = u_basic_breakup_string(old_name_value_pair, '=', 0);
+      o_attrib_get_name_value(old_name_value_pair, &old_attrib_name, NULL);
       if ( (strcmp(old_attrib_name, "refdes") != 0) &&
 	   (strcmp(old_attrib_name, "net") != 0) &&
 	   (strcmp(old_attrib_name, "slot") != 0) &&
@@ -683,7 +683,7 @@ void s_toplevel_update_component_attribs_in_toplevel(OBJECT *o_current,
 
   /*  Now get the old attrib name & value from complete_comp_attrib_list 
    *  and value from o_current  */
-  old_attrib_name = u_basic_breakup_string(local_list->data, '=', 0); 
+  o_attrib_get_name_value(local_list->data, &old_attrib_name, NULL);
   old_attrib_value = o_attrib_search_name_single_count(o_current, old_attrib_name, 0);
 
 #if DEBUG
@@ -694,7 +694,7 @@ void s_toplevel_update_component_attribs_in_toplevel(OBJECT *o_current,
 #endif
 
   /*  Next try to get this attrib from new_comp_attrib_list  */
-  new_attrib_name = u_basic_breakup_string(local_list->data, '=', 0);
+  o_attrib_get_name_value(local_list->data, &new_attrib_name, NULL);
   if (s_string_list_in_list(new_comp_attrib_list, local_list->data)) {
     new_attrib_value = s_misc_remaining_string(local_list->data, '=', 1);      
   } else {
@@ -931,8 +931,7 @@ void s_toplevel_update_pin_attribs_in_toplevel(char *refdes, OBJECT *o_pin,
   printf("        In s_toplevel_update_pin_attribs_in_toplevel, handling entry in master list %s .\n", new_name_value_pair);
 #endif
 
-  new_attrib_name = u_basic_breakup_string(new_name_value_pair, '=', 0);
-  new_attrib_value = u_basic_breakup_string(new_name_value_pair, '=', 1);
+  o_attrib_get_name_value(new_name_value_pair, &new_attrib_name, &new_attrib_value);
 
   if (strlen(new_attrib_value) == 0) {
     g_free(new_attrib_value);   
-- 
1.5.6




_______________________________________________
geda-dev mailing list
geda-dev@moria.seul.org
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev