commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 30/148: being more c++y with the ring


From: git
Subject: [Commit-gnuradio] [gnuradio] 30/148: being more c++y with the ring
Date: Mon, 15 Aug 2016 00:47:21 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

nwest pushed a commit to annotated tag old_usrp_devel_udp
in repository gnuradio.

commit 473a57e39a509b8232ed61a8bb54b8bd7da9e60a
Author: Josh Blum <address@hidden>
Date:   Fri Nov 6 00:03:45 2009 -0800

    being more c++y with the ring
---
 usrp2/host/lib/eth_data_transport.cc |  1 -
 usrp2/host/lib/ring.cc               | 15 ++++++---------
 usrp2/host/lib/ring.h                |  2 +-
 usrp2/host/lib/usrp2_impl.cc         |  4 ++--
 4 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/usrp2/host/lib/eth_data_transport.cc 
b/usrp2/host/lib/eth_data_transport.cc
index 6286bfe..2dfae43 100644
--- a/usrp2/host/lib/eth_data_transport.cc
+++ b/usrp2/host/lib/eth_data_transport.cc
@@ -71,7 +71,6 @@ int usrp2::eth_data_transport::sendv(const iovec *iov, size_t 
iovlen){
 }
 
 std::vector<usrp2::sbuff::sptr> usrp2::eth_data_transport::recv(){
-    void *base;
     std::vector<sbuff::sptr> sbs;
     DEBUG_LOG(":");
     // Receive available frames from ethernet buffer.  Handler will
diff --git a/usrp2/host/lib/ring.cc b/usrp2/host/lib/ring.cc
index 334ddb4..ac1bda2 100644
--- a/usrp2/host/lib/ring.cc
+++ b/usrp2/host/lib/ring.cc
@@ -28,13 +28,10 @@
 namespace usrp2 {
 
   ring::ring(unsigned int entries)
-    : d_max(entries), d_read_ind(0), d_write_ind(0), d_ring(entries),
+    : d_max(entries), d_read_ind(0), d_write_ind(0),
+      d_ring(entries, sbuff::make()),
       d_mutex(), d_not_empty()
-  {
-    for (unsigned int i = 0; i < entries; i++) {
-      d_ring[i] = sbuff::make(); //load empty sbuff
-    }
-  }
+  {/*NOP*/}
 
   void 
   ring::wait_for_not_empty() 
@@ -59,13 +56,13 @@ namespace usrp2 {
   }
 
   bool
-  ring::dequeue(sbuff::sptr *sb)
+  ring::dequeue(sbuff::sptr &sb)
   {
     gruel::scoped_lock l(d_mutex);
     if (empty())
       return false;
-      
-    *sb = d_ring[d_read_ind];
+
+    sb = d_ring[d_read_ind];
     d_ring[d_read_ind] = sbuff::make(); //replace it with an empty sbuff
 
     inc_read_ind();
diff --git a/usrp2/host/lib/ring.h b/usrp2/host/lib/ring.h
index 2111134..0e8d76e 100644
--- a/usrp2/host/lib/ring.h
+++ b/usrp2/host/lib/ring.h
@@ -71,7 +71,7 @@ namespace usrp2 {
     void wait_for_not_empty();
 
     bool enqueue(sbuff::sptr sb);
-    bool dequeue(sbuff::sptr *sb);
+    bool dequeue(sbuff::sptr &sb);
   };
 
 }  // namespace usrp2
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index 14d673b..d279e06 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -583,7 +583,7 @@ namespace usrp2 {
     
     // Iterate through frames and present to user
     sbuff::sptr sb;
-    while (rp->dequeue(&sb)) {
+    while (rp->dequeue(sb)) {
       uint32_t        *items;                  // points to beginning of data 
items
       size_t           nitems_in_uint32s;
       rx_metadata      md;
@@ -623,7 +623,7 @@ namespace usrp2 {
 
     // Iterate through frames and drop them
     sbuff::sptr sb;
-    while (rp->dequeue(&sb)) {
+    while (rp->dequeue(sb)) {
       sb.reset(); //reset to call cleanup callback
       dec_enqueued();
     }



reply via email to

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