Revision: 47034
          http://brlcad.svn.sourceforge.net/brlcad/?rev=47034&view=rev
Author:   brlcad
Date:     2011-10-03 19:45:35 +0000 (Mon, 03 Oct 2011)
Log Message:
-----------
use vls strings instead of a fixed buffer.  strcat for efficiency.  may want to 
consider bn_mat_print*() functions instead of rolling your own like this.  
remove c++-style comment.

Modified Paths:
--------------
    brlcad/trunk/src/libged/simulate/simulate.c

Modified: brlcad/trunk/src/libged/simulate/simulate.c
===================================================================
--- brlcad/trunk/src/libged/simulate/simulate.c 2011-10-03 19:01:49 UTC (rev 
47033)
+++ brlcad/trunk/src/libged/simulate/simulate.c 2011-10-03 19:45:35 UTC (rev 
47034)
@@ -71,20 +71,21 @@
 void print_matrix(char *rb_namep, mat_t t)
 {
        int i, j;
-       char buffer[500];
+       struct bu_vls buffer = BU_VLS_INIT_ZERO;
 
-       sprintf(buffer, "------------Transformation matrix(%s)--------------\n",
-                       rb_namep);
+       bu_vls_sprintf(&buffer, "------------Transformation 
matrix(%s)--------------\n",
+                      rb_namep);
 
        for (i=0 ; i<4 ; i++) {
                for (j=0 ; j<4 ; j++) {
-                       sprintf(buffer, "%st[%d]: %f\t", buffer, (i*4 + j), 
t[i*4 + j] );
+                       bu_vls_sprintf(&buffer, "t[%d]: %f\t", (i*4 + j), t[i*4 
+ j] );
                }
-               sprintf(buffer, "%s\n", buffer);
+               bu_vls_strcat(&buffer, "\n");
        }
 
-       sprintf(buffer, 
"%s-------------------------------------------------------\n", buffer);
-       bu_log(buffer);
+       bu_vls_strcat(&buffer, 
"-------------------------------------------------------\n");
+       bu_log("%V", &buffer);
+       bu_vls_free(&buffer);
 }
 
 
@@ -699,7 +700,7 @@
                bu_free(prefixed_name, "simulate : prefixed_name");
                bu_free(prefixed_reg_name, "simulate : prefixed_reg_name");
 
-       }//end for-manifold
+       } /* end for-manifold */
 
 
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to