commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9007 - usrp2/branches/features/host-ng/host-ng/apps


From: eb
Subject: [Commit-gnuradio] r9007 - usrp2/branches/features/host-ng/host-ng/apps
Date: Thu, 24 Jul 2008 16:53:52 -0600 (MDT)

Author: eb
Date: 2008-07-24 16:53:51 -0600 (Thu, 24 Jul 2008)
New Revision: 9007

Modified:
   usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc
Log:
cleanup

Modified: usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc
===================================================================
--- usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc  2008-07-24 
21:39:11 UTC (rev 9006)
+++ usrp2/branches/features/host-ng/host-ng/apps/test_usrp2.cc  2008-07-24 
22:53:51 UTC (rev 9007)
@@ -28,6 +28,7 @@
 #include <sys/time.h>
 #include <iostream>
 #include <string.h>
+#include <boost/scoped_ptr.hpp>
 
 static void
 usage(const char *progname)
@@ -140,7 +141,7 @@
   }
 
   size_t bufsize = static_cast<size_t>(100e6);
-  unsigned char *buf = (unsigned char *)malloc(bufsize);
+  boost::scoped_ptr<unsigned char> buf(new unsigned char[bufsize]);
 
   printf("Receiving data ten times into buffer of length %li bytes.\n\n", 
bufsize);
 
@@ -154,7 +155,7 @@
   unsigned long times = 0;
   
   do {
-    usrp2::copy_handler h(buf, bufsize);
+    usrp2::copy_handler h(buf.get(), bufsize);
     bool ok;
     unsigned int n = 0;
     do {
@@ -190,6 +191,5 @@
   printf("Total instances of overruns was %d.\n", u2->rx_overruns());
   printf("Total missing frames was %d.\n", u2->rx_missing()); 
 
-  free(buf);
   return 0;
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]