Random simplifications, cosmetics/whitespace/consistency fixes.
[pulseview.git] / pv / data / segment.cpp
index 86211f8218f52d02eb8ed59df0e2eecf998379a9..88015c3639860597accf8bf23eb21ed98d499e53 100644 (file)
 #include <cassert>
 #include <cstdlib>
 #include <cstring>
-#include <vector>
 
 using std::lock_guard;
 using std::min;
 using std::recursive_mutex;
-using std::vector;
 
 namespace pv {
 namespace data {
@@ -119,8 +117,7 @@ void Segment::append_single_sample(void *data)
        // There will always be space for at least one sample in
        // the current chunk, so we do not need to test for space
 
-       memcpy(current_chunk_ + (used_samples_ * unit_size_),
-               data, unit_size_);
+       memcpy(current_chunk_ + (used_samples_ * unit_size_), data, unit_size_);
        used_samples_++;
        unused_samples_--;
 
@@ -224,14 +221,12 @@ void Segment::continue_raw_sample_iteration(SegmentRawDataIterator* it, uint64_t
 {
        lock_guard<recursive_mutex> lock(mutex_);
 
+       // Fail gracefully if we are asked to deliver data we don't have
        if (it->sample_index > sample_count_)
-       {
-               // Fail gracefully if we are asked to deliver data we don't have
                return;
-       } else {
-               it->sample_index += increase;
-               it->chunk_offs += (increase * unit_size_);
-       }
+
+       it->sample_index += increase;
+       it->chunk_offs += (increase * unit_size_);
 
        if (it->chunk_offs > (chunk_size_ - 1)) {
                it->chunk_num++;
@@ -254,6 +249,5 @@ void Segment::end_raw_sample_iteration(SegmentRawDataIterator* it)
        }
 }
 
-
 } // namespace data
 } // namespace pv