Skip to content

Commit 4f225da

Browse files
committed
Merge branch 'string-view' into network-interfaces
2 parents c551ff9 + ab4a66d commit 4f225da

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

include/reactor-cpp/assert.hh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ using EnvPhase = Environment::Phase;
3838

3939
class ValidationError : public std::runtime_error {
4040
private:
41-
static auto build_message(const std::string& msg) noexcept -> std::string;
41+
static auto build_message(std::string_view msg) noexcept -> std::string;
4242

4343
public:
44-
explicit ValidationError(const std::string& msg)
44+
explicit ValidationError(const std::string_view msg)
4545
: std::runtime_error(build_message(msg)) {}
4646
};
4747

@@ -56,7 +56,7 @@ inline void print_debug_backtrace() {
5656
}
5757
#endif
5858

59-
constexpr inline void validate([[maybe_unused]] bool condition, [[maybe_unused]] const std::string& message) {
59+
constexpr inline void validate([[maybe_unused]] bool condition, [[maybe_unused]] const std::string_view message) {
6060
if constexpr (runtime_validation) { // NOLINT
6161
if (!condition) {
6262
#ifdef __linux__

include/reactor-cpp/scheduler.hh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ private:
6565
std::atomic<std::ptrdiff_t> size_{0};
6666
Semaphore sem_{0};
6767
std::ptrdiff_t waiting_workers_{0};
68-
const unsigned int num_workers_;
68+
const std::ptrdiff_t num_workers_;
6969
log::NamedLogger& log_;
7070

7171
public:
72-
explicit ReadyQueue(log::NamedLogger& log, unsigned num_workers)
72+
explicit ReadyQueue(log::NamedLogger& log, std::ptrdiff_t num_workers)
7373
: num_workers_(num_workers)
7474
, log_(log) {}
7575

lib/assert.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace reactor {
1212

13-
auto ValidationError::build_message(const std::string& msg) noexcept -> std::string {
13+
auto ValidationError::build_message(const std::string_view msg) noexcept -> std::string {
1414
std::stringstream string_stream;
1515
string_stream << "Validation Error! \"" << msg << "\"";
1616
return string_stream.str();

lib/scheduler.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void ReadyQueue::fill_up(std::vector<Reaction*>& ready_reactions) {
137137
// one worker running running, new_size - running_workers indicates the
138138
// number of additional workers needed to process all reactions.
139139
waiting_workers_ += -old_size;
140-
auto running_workers = num_workers_ - waiting_workers_;
140+
std::ptrdiff_t running_workers{num_workers_ - waiting_workers_};
141141
auto workers_to_wakeup = std::min(waiting_workers_, new_size - running_workers);
142142

143143
// wakeup other workers_

lib/time.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
namespace reactor {
2121

22-
constexpr size_t TIME_TO_STR_BUFFER_SIZE{20};
23-
constexpr size_t NANOSECONDS_IN_ONE_SECOND{1'000'000'000UL};
24-
constexpr size_t NANOSECOND_DIGITS{9};
22+
constexpr std::size_t TIME_TO_STR_BUFFER_SIZE{20};
23+
constexpr std::size_t NANOSECONDS_IN_ONE_SECOND{1'000'000'000UL};
24+
constexpr std::size_t NANOSECOND_DIGITS{9};
2525

2626
inline namespace operators {
2727

0 commit comments

Comments
 (0)