From: Emden R. Gansner <erg@research.att.com>
Date: Fri, 16 Aug 2013 20:00:38 +0000 (-0400)
Subject: Mark internally used functions as static;
X-Git-Tag: LAST_LIBGRAPH~32^2~70
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b361c71d516f036426dc0896875bb09fdbedccb0;p=graphviz

Mark internally used functions as static;
wrap info printing with if (Verbose).
---

diff --git a/lib/mingle/edge_bundling.c b/lib/mingle/edge_bundling.c
index 49dc8e18d..256ffd096 100644
--- a/lib/mingle/edge_bundling.c
+++ b/lib/mingle/edge_bundling.c
@@ -395,7 +395,8 @@ void pedge_export_mma(FILE *fp, int ne, pedge *edges){
   fprintf(fp,"}]\n");
 }
 
-void pedge_print(char *comments, pedge e){
+#ifdef DEBUG
+static void pedge_print(char *comments, pedge e){
   int i, j, dim;
   dim = e->dim;
   fprintf(stderr,"%s", comments);
@@ -410,6 +411,7 @@ void pedge_print(char *comments, pedge e){
   }
   fprintf(stderr,"\n");
 }
+#endif
 
 pedge pedge_realloc(pedge e, int n){
   if (n <= e->npoints) return e;
@@ -616,6 +618,7 @@ static pedge* force_directed_edge_bundling(SparseMatrix A, pedge* edges, int max
       
     }
     step = step*0.9;
+  if (Verbose)
     fprintf(stderr, "iter ==== %d cpu = %f npoints = %d\n",iter, ((real) (clock() - start))/CLOCKS_PER_SEC, np - 2);
 
 #ifdef OPENGL
@@ -639,7 +642,7 @@ static real absfun(real x){
 
 
 
-pedge* modularity_ink_bundling(int dim, int ne, SparseMatrix B, pedge* edges, real angle_param, real angle){
+static pedge* modularity_ink_bundling(int dim, int ne, SparseMatrix B, pedge* edges, real angle_param, real angle){
   int *assignment = NULL, flag, nclusters;
   real modularity;
   int *clusterp, *clusters;
@@ -680,7 +683,8 @@ pedge* modularity_ink_bundling(int dim, int ne, SparseMatrix B, pedge* edges, re
   clusters = D->ja;
   for (i = 0; i < nclusters; i++){
     ink1 = ink(edges, clusterp[i+1] - clusterp[i], &(clusters[clusterp[i]]), &ink0, &meet1, &meet2, angle_param, angle);
-    fprintf(stderr,"nedges = %d ink0 = %f, ink1 = %f\n",clusterp[i+1] - clusterp[i], ink0, ink1);
+    if (Verbose)
+      fprintf(stderr,"nedges = %d ink0 = %f, ink1 = %f\n",clusterp[i+1] - clusterp[i], ink0, ink1);
     if (ink1 < ink0){
       for (j = clusterp[i]; j < clusterp[i+1]; j++){
 	/* make this edge 5 points, insert two meeting points at 1 and 2, make 3 the last point */
@@ -742,7 +746,8 @@ static SparseMatrix check_compatibility(SparseMatrix A, int ne, pedge *edges, in
   //SparseMatrix_print("C",C);
   SparseMatrix_delete(B);
   B = C;
-  fprintf(stderr, "edge compatibilitu time = %f\n",((real) (clock() - start))/CLOCKS_PER_SEC);
+  if (Verbose)
+    fprintf(stderr, "edge compatibilitu time = %f\n",((real) (clock() - start))/CLOCKS_PER_SEC);
   return B;
 }
 
diff --git a/lib/mingle/ink.c b/lib/mingle/ink.c
index 9bee033f6..c4c4f9e10 100644
--- a/lib/mingle/ink.c
+++ b/lib/mingle/ink.c
@@ -19,28 +19,28 @@
 
 double ink_count;
 
-point_t addPoint (point_t a, point_t b)
+static point_t addPoint (point_t a, point_t b)
 {
   a.x += b.x;
   a.y += b.y;
   return a;
 }
 
-point_t subPoint (point_t a, point_t b)
+static point_t subPoint (point_t a, point_t b)
 {
   a.x -= b.x;
   a.y -= b.y;
   return a;
 }
 
-point_t scalePoint (point_t a, double d)
+static point_t scalePoint (point_t a, double d)
 {
   a.x *= d;
   a.y *= d;
   return a;
 }
 
-double dotPoint(point_t a, point_t b){
+static double dotPoint(point_t a, point_t b){
   return a.x*b.x + a.y*b.y;
 }
 
@@ -49,7 +49,7 @@ point_t Origin;
 
 /* sumLengths:
  */
-double sumLengths_avoid_bad_angle(point_t* points, int npoints, point_t end, point_t meeting, real angle_param) 
+static double sumLengths_avoid_bad_angle(point_t* points, int npoints, point_t end, point_t meeting, real angle_param) 
 {
   /* avoid sharp turns, we want cos_theta to be as close to -1 as possible */
   int i;
@@ -74,7 +74,7 @@ double sumLengths_avoid_bad_angle(point_t* points, int npoints, point_t end, poi
   // distance of single line from 'meeting' to 'end'
   return sum*(cos_max + angle_param);/* straight line gives angle_param - 1, turning angle of 180 degree gives angle_param + 1 */
 }
-double sumLengths(point_t* points, int npoints, point_t end, point_t meeting) 
+static double sumLengths(point_t* points, int npoints, point_t end, point_t meeting) 
 {
   int i;
   double sum = 0;
@@ -95,7 +95,7 @@ double sumLengths(point_t* points, int npoints, point_t end, point_t meeting)
 
 /* bestInk:
  */
-double bestInk(point_t* points, int npoints, point_t begin, point_t end, double prec, point_t *meet, real angle_param)
+static double bestInk(point_t* points, int npoints, point_t begin, point_t end, double prec, point_t *meet, real angle_param)
 {
   point_t first, second, third, fourth, diff, meeting;
   double value1, value2, value3, value4;