]> granicus.if.org Git - graphviz/commitdiff
replace int-to-string operation in attached_clustering with new itos
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 5 May 2021 04:41:39 +0000 (21:41 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 11 May 2021 14:32:54 +0000 (07:32 -0700)
This commit serves to demonstrate how to use the function added in the prior
commit.

lib/sparse/DotIO.c

index 8bfe6d04385f1bc3e13e8e18318ff66f4861a251..59cb331a78b14c341b28de8dd1f47efb624487e3 100644 (file)
@@ -9,6 +9,7 @@
  *************************************************************************/
 
 #define STANDALONE
+#include <cgraph/itos.h>
 #include <cgraph/sprint.h>
 #include <sparse/general.h>
 #include <sparse/DotIO.h>
@@ -1031,8 +1032,6 @@ void attached_clustering(Agraph_t* g, int maxcluster, int clustering_scheme){
   real v;
   int type = MATRIX_TYPE_REAL;
   size_t sz = sizeof(real);
-  char scluster[100];
-
 
   int *clusters;
 
@@ -1092,8 +1091,7 @@ void attached_clustering(Agraph_t* g, int maxcluster, int clustering_scheme){
     for (i = 0; i < nnodes; i++) (clusters)[i]++;/* make into 1 based */
     for (n = agfstnode (g); n; n = agnxtnode (g, n)) {
       i = ND_id(n);
-      sprintf(scluster,"%d",(clusters)[i]);
-      agxset(n,clust_sym,scluster);
+      agxset(n, clust_sym, itos((clusters)[i]).str);
     }
     if (Verbose){
       fprintf(stderr," no complement clustering info in dot file, using modularity clustering. Modularity = %f, ncluster=%d\n",modularity, nc);