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

gEDA-cvs: pcb.git: branch: master updated (3258110fb9d36ceb0519271a42b09f9213192211)



The branch, master has been updated
       via  3258110fb9d36ceb0519271a42b09f9213192211 (commit)
       via  6c89151f6c60d2025d7e1e40e482df142483cf48 (commit)
      from  acbf10c2bf1814c5ffbe13dbcfd03fc9ffcaca89 (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
=========

 src/hid/gtk/gui-dialog-size.c |   21 +--------------------
 src/misc.c                    |   23 +++++++++++++++++++++++
 src/misc.h                    |    1 +
 src/mymem.c                   |   13 +++++++------
 src/mymem.h                   |    2 +-
 5 files changed, 33 insertions(+), 27 deletions(-)


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

commit 3258110fb9d36ceb0519271a42b09f9213192211
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Move make_route_string() from gtk into misc.c

:100644 100644 8cc9185... e3047bb... M	src/hid/gtk/gui-dialog-size.c
:100644 100644 ee7e26d... 1000400... M	src/misc.c
:100644 100644 49246f1... a0220c0... M	src/misc.h

commit 6c89151f6c60d2025d7e1e40e482df142483cf48
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Const-correct StripWhiteSpaceAndDup in mymem.c

:100644 100644 1feb2ef... 73b3ef7... M	src/mymem.c
:100644 100644 cbfd47e... a66e349... M	src/mymem.h

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

commit 3258110fb9d36ceb0519271a42b09f9213192211
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Move make_route_string() from gtk into misc.c

diff --git a/src/hid/gtk/gui-dialog-size.c b/src/hid/gtk/gui-dialog-size.c
index 8cc9185..e3047bb 100644
--- a/src/hid/gtk/gui-dialog-size.c
+++ b/src/hid/gtk/gui-dialog-size.c
@@ -65,25 +65,6 @@ SizesDialog;
 
 static SizesDialog route_sizes;
 
-static gchar *
-make_route_string(RouteStyleType * rs)
-{
-  gchar *str, *s, *t, *colon;
-  gint i;
-
-  str = g_strdup("");
-  for (i = 0; i < NUM_STYLES; ++i, ++rs)
-    {
-      s = pcb_g_strdup_printf ("%s,%mc,%mc,%mc,%mc", rs->Name,
-               rs->Thick, rs->Diameter, rs->Hole, rs->Keepaway);
-      colon = (i == NUM_STYLES - 1) ? NULL : (gchar *)":";
-      t = str;
-      str = g_strconcat (str, s, colon, NULL);
-      g_free (t);
-	}
-  return str;
-}
-
 static void
 via_hole_cb (GHidCoordEntry * entry, gpointer data)
 {
@@ -295,7 +276,7 @@ ghid_route_style_dialog (gint index, RouteStyleType * temp_rst)
 
 	  Settings.RouteStyle[index] = *rst;
 	  ghidgui->config_modified = TRUE;
-	  s = make_route_string (&Settings.RouteStyle[0]);
+	  s = make_route_string (Settings.RouteStyle, NUM_STYLES);
 	  g_free (Settings.Routes);
 	  Settings.Routes = s;
 	}
diff --git a/src/misc.c b/src/misc.c
index ee7e26d..1000400 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -890,6 +890,29 @@ GetNum (char **s, const char *default_unit)
   return ret_val;
 }
 
+/*! \brief Serializes the route style list 
+ *  \par Function Description
+ *  Right now n_styles should always be set to NUM_STYLES,
+ *  since that is the number of route styles ParseRouteString()
+ *  expects to parse.
+ */
+char *
+make_route_string (RouteStyleType rs[], int n_styles)
+{
+  GString *str = g_string_new ("");
+  gint i;
+
+  for (i = 0; i < n_styles; ++i)
+    {
+      char *r_string = pcb_g_strdup_printf ("%s,%mc,%mc,%mc,%mc", rs[i].Name,
+                                            rs[i].Thick, rs[i].Diameter,
+                                            rs[i].Hole, rs[i].Keepaway);
+      if (i > 0)
+        g_string_append_c (str, ':');
+      g_string_append (str, r_string);
+    }
+  return g_string_free (str, FALSE);
+}
 
 /* ----------------------------------------------------------------------
  * parses the routes definition string which is a colon separated list of
diff --git a/src/misc.h b/src/misc.h
index 49246f1..a0220c0 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -63,6 +63,7 @@ void CountHoles (int *, int *, const BoxType *);
 BoxTypePtr GetDataBoundingBox (DataTypePtr);
 void CenterDisplay (Coord, Coord);
 void SetFontInfo (FontTypePtr);
+char *make_route_string (RouteStyleType rs[], int n_styles);
 int ParseGroupString (char *, LayerGroupTypePtr, int /* LayerN */);
 int ParseRouteString (char *, RouteStyleTypePtr, const char *);
 void QuitApplication (void);

commit 6c89151f6c60d2025d7e1e40e482df142483cf48
Author: Andrew Poelstra <asp11@xxxxxx>
Commit: Andrew Poelstra <asp11@xxxxxx>

    Const-correct StripWhiteSpaceAndDup in mymem.c

diff --git a/src/mymem.c b/src/mymem.c
index 1feb2ef..73b3ef7 100644
--- a/src/mymem.c
+++ b/src/mymem.c
@@ -848,9 +848,10 @@ DSClearString (DynamicStringTypePtr Ptr)
  * holds only white space characters
  */
 char *
-StripWhiteSpaceAndDup (char *S)
+StripWhiteSpaceAndDup (const char *S)
 {
-  char *p1, *p2;
+  const char *p1, *p2;
+  char *copy;
   size_t length;
 
   if (!S || !*S)
@@ -866,10 +867,10 @@ StripWhiteSpaceAndDup (char *S)
   /* string is not empty -> allocate memory */
   if (length)
     {
-      p2 = (char *)realloc (NULL, length + 1);
-      strncpy (p2, p1, length);
-      *(p2 + length) = '\0';
-      return (p2);
+      copy = (char *)realloc (NULL, length + 1);
+      strncpy (copy, p1, length);
+      copy[length] = '\0';
+      return (copy);
     }
   else
     return (NULL);
diff --git a/src/mymem.h b/src/mymem.h
index cbfd47e..a66e349 100644
--- a/src/mymem.h
+++ b/src/mymem.h
@@ -100,7 +100,7 @@ void FreePointerListMemory (PointerListTypePtr);
 void DSAddCharacter (DynamicStringTypePtr, char);
 void DSAddString (DynamicStringTypePtr, const char *);
 void DSClearString (DynamicStringTypePtr);
-char *StripWhiteSpaceAndDup (char *);
+char *StripWhiteSpaceAndDup (const char *);
 
 #ifdef NEED_STRDUP
 char *strdup (const char *);




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