diff options
author | Wyatt Hepler <hepler@google.com> | 2022-06-29 00:15:46 +0000 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-06-29 00:15:46 +0000 |
commit | 6c5df358e638a6f6677c8f000170266c836f674d (patch) | |
tree | ddaf6a4467fadb18776fb2ed404024e074274d86 /pw_work_queue | |
parent | 175770017a7e23864f358fd0d06bdd96d3ba8931 (diff) | |
download | pigweed-6c5df358e638a6f6677c8f000170266c836f674d.tar.gz |
pw_span: Switch from std::span to pw::span
This changes uses of std::span to pw::span. No changes are made to build
dependencies in this commit.
This change was made with the following shell script:
#!/bin/bash
readonly FILES="$(git ls-files '*.rst' '*.md' '*.h' '*.cc' '*.py')"
readonly PW_NS_FILES="$(git grep -l 'namespace pw\>' | grep -v generate_decoding_test_data.cc)"
echo "Updating #includes"
sed -i --follow-symlinks \
's/#include <span>/#include "pw_span\/span.h"/g' ${FILES}
for name in span as_bytes as_writable_bytes dynamic_extent; do
echo Renaming std::$name to pw::$name
sed -i --follow-symlinks "s/std::$name/pw::$name/g" ${FILES}
sed -i --follow-symlinks "s/pw::$name/$name/g" ${PW_NS_FILES}
sed -i --follow-symlinks "s/using $name;//" ${PW_NS_FILES}
done
git checkout pw_span
pw format -b origin/main --fix
Bug: b/235237667
Change-Id: I32edfbcb7cadf3ab39009596fdb7275fcc5ea3f5
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/98264
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com>
Diffstat (limited to 'pw_work_queue')
-rw-r--r-- | pw_work_queue/public/pw_work_queue/internal/circular_buffer.h | 7 | ||||
-rw-r--r-- | pw_work_queue/public/pw_work_queue/work_queue.h | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/pw_work_queue/public/pw_work_queue/internal/circular_buffer.h b/pw_work_queue/public/pw_work_queue/internal/circular_buffer.h index 55295d0b3..6482fd182 100644 --- a/pw_work_queue/public/pw_work_queue/internal/circular_buffer.h +++ b/pw_work_queue/public/pw_work_queue/internal/circular_buffer.h @@ -16,7 +16,8 @@ #include <cstdint> #include <optional> -#include <span> + +#include "pw_span/span.h" namespace pw::work_queue::internal { @@ -24,7 +25,7 @@ namespace pw::work_queue::internal { template <typename T> class CircularBuffer { public: - explicit constexpr CircularBuffer(std::span<T> buffer) + explicit constexpr CircularBuffer(span<T> buffer) : buffer_(buffer), head_(0), tail_(0), count_(0) {} bool empty() const { return count_ == 0; } @@ -68,7 +69,7 @@ class CircularBuffer { } } - std::span<T> buffer_; + span<T> buffer_; size_t head_; size_t tail_; diff --git a/pw_work_queue/public/pw_work_queue/work_queue.h b/pw_work_queue/public/pw_work_queue/work_queue.h index 9b592b820..7afb74e02 100644 --- a/pw_work_queue/public/pw_work_queue/work_queue.h +++ b/pw_work_queue/public/pw_work_queue/work_queue.h @@ -16,10 +16,10 @@ #include <array> #include <cstdint> -#include <span> #include "pw_function/function.h" #include "pw_metric/metric.h" +#include "pw_span/span.h" #include "pw_status/status.h" #include "pw_sync/interrupt_spin_lock.h" #include "pw_sync/lock_annotations.h" @@ -38,7 +38,7 @@ using WorkItem = Function<void()>; class WorkQueue : public thread::ThreadCore { public: // Note: the ThreadNotification prevents this from being constexpr. - explicit WorkQueue(std::span<WorkItem> queue_storage) + explicit WorkQueue(span<WorkItem> queue_storage) : stop_requested_(false), circular_buffer_(queue_storage) {} // Enqueues a work_item for execution by the work queue thread. |