[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.7.0-20110116-41-g06925a4)



The branch, master has been updated
       via  06925a44059c630ed99aa25ebebce8146cc56e47 (commit)
      from  c7e23d6238b0013830f0db4157a799c0657936cb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gnetlist/src/s_rename.c |   71 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 52 insertions(+), 19 deletions(-)


=================
 Commit Messages
=================

commit 06925a44059c630ed99aa25ebebce8146cc56e47
Author: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>

    gnetlist: fix multiple renames for same source net
    
    It might happen an existing rename for A->B exists when a new rename
    A->C is added. This means B and C should be made equivalent.
    
    This patch arbitrarily choses one of these nets by renaming C->B instead
    of originally requested A->C.
    
    Closes-bug: lp-698570
    Closes-bug: lp-698395

:100644 100644 406a8a8... e847b11... M	gnetlist/src/s_rename.c

=========
 Changes
=========

commit 06925a44059c630ed99aa25ebebce8146cc56e47
Author: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>

    gnetlist: fix multiple renames for same source net
    
    It might happen an existing rename for A->B exists when a new rename
    A->C is added. This means B and C should be made equivalent.
    
    This patch arbitrarily choses one of these nets by renaming C->B instead
    of originally requested A->C.
    
    Closes-bug: lp-698570
    Closes-bug: lp-698395

diff --git a/gnetlist/src/s_rename.c b/gnetlist/src/s_rename.c
index 406a8a8..e847b11 100644
--- a/gnetlist/src/s_rename.c
+++ b/gnetlist/src/s_rename.c
@@ -156,6 +156,31 @@ int s_rename_search(char *src, char *dest, int quiet_flag)
     return (FALSE);
 }
 
+static void s_rename_add_lowlevel (const char *src, const char *dest)
+{
+    RENAME *new_rename;
+
+    g_return_if_fail(last_set != NULL);
+
+    new_rename = g_malloc(sizeof (RENAME));
+
+    g_return_if_fail(new_rename != NULL);
+
+    new_rename->next = NULL;
+    new_rename->src = g_strdup(src);
+    new_rename->dest = g_strdup(dest);
+
+    if (last_set->first_rename == NULL)
+    {
+        last_set->first_rename = last_set->last_rename = new_rename;
+    }
+    else
+    {
+        last_set->last_rename->next = new_rename;
+        last_set->last_rename = new_rename;
+    }
+}
+
 void s_rename_add(char *src, char *dest)
 {
     int flag;
@@ -177,27 +202,35 @@ void s_rename_add(char *src, char *dest)
 	last = last_set->last_rename;
 	for (temp = last_set->first_rename; ; temp = temp->next)
 	{
-            if (strcmp(dest, temp->src) == 0) 
-	    {
+        if ((strcmp(dest, temp->src) == 0)
+            && (strcmp(src, temp->dest) != 0))
+        {
+            /* we found a -> b, while adding c -> a.
+             * hence we would have c -> a -> b, so add c -> b.
+             * avoid renaming if b is same as c!
+             */
 #if DEBUG
-                printf("Found dest [%s] in src [%s] and that had a dest as: [%s]\nSo you want rename [%s] to [%s]\n",
-                       dest, temp->src, temp->dest, src, temp->dest);
+            printf("Found dest [%s] in src [%s] and that had a dest as: [%s]\n"
+                   "So you want rename [%s] to [%s]\n",
+                   dest, temp->src, temp->dest, src, temp->dest);
 #endif
-                new_rename = g_malloc(sizeof(RENAME));
-		     new_rename->next = NULL;
-                     new_rename->src = g_strdup(src);
-                     new_rename->dest = g_strdup(temp->dest);
-		     /* If the rename pair was found then a set already exists, so there's no need the check it */
-		     if (last_set->first_rename == NULL)
-		     {
-		         last_set->first_rename = last_set->last_rename = new_rename;
-		     }
-		     else
-		     {
-		         last_set->last_rename->next = new_rename;
-			 last_set->last_rename = new_rename;
-		     } 
-            }
+            s_rename_add_lowlevel(src, temp->dest);
+
+        }
+        else if ((strcmp(src, temp->src) == 0)
+                 && (strcmp(dest, temp->dest) != 0))
+        {
+            /* we found a -> b, while adding a -> c.
+             * hence b <==> c, so add c -> b.
+             * avoid renaming if b is same as c!
+             */
+#if DEBUG
+            printf("Found src [%s] that had a dest as: [%s]\n"
+                   "Unify nets by renaming [%s] to [%s]\n",
+                   src, temp->dest, dest, temp->dest);
+#endif
+            s_rename_add_lowlevel(dest, temp->dest);
+        }
             if (temp == last)
             {
                 break;



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