Skip to content

Commit

Permalink
address requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
cvonelm committed Oct 22, 2024
1 parent b50f989 commit 2d7e02c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions include/lo2s/ringbuf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ class RingBufWriter : public ShmRingbuf

std::byte* reserve(size_t ev_size)
{
if (ev_size == 0)
{
return nullptr;
}

// No other reservation can be active!
assert(reserved_size_ == 0);

Expand Down Expand Up @@ -201,6 +206,11 @@ class RingBufReader : public ShmRingbuf

std::byte* get(size_t size)
{
if (size == 0)
{
return nullptr;
}

if (!can_be_loaded(size))
{
return nullptr;
Expand All @@ -210,6 +220,11 @@ class RingBufReader : public ShmRingbuf

void pop(size_t ev_size)
{
if (ev_size == 0)
{
return;
}

// Calling pop() without trying to get() data from the ringbuffer first is an error
assert(can_be_loaded(ev_size));

Expand Down
2 changes: 1 addition & 1 deletion src/monitor/process_monitor_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static void drop_privileges()
assert(getgid() != 0);
}

std::vector<char*> to_vector_of_c_str(std::vector<std::string> vec)
std::vector<char*> to_vector_of_c_str(const std::vector<std::string> vec)
{
std::vector<char*> res;
std::transform(vec.begin(), vec.end(), std::back_inserter(res), [](const std::string& s) {
Expand Down

0 comments on commit 2d7e02c

Please sign in to comment.