sdevent: Support getting userdata
Will be needed when we start storing the userdata on the heap
Change-Id: I31d2c2b6741d0a4422a79b4d0a752d352121ae3c
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/sdeventplus/internal/sdevent.cpp b/src/sdeventplus/internal/sdevent.cpp
index 6d8cde9..ece6b50 100644
--- a/src/sdeventplus/internal/sdevent.cpp
+++ b/src/sdeventplus/internal/sdevent.cpp
@@ -127,6 +127,11 @@
return ::sd_event_source_unref(source);
}
+void* SdEventImpl::sd_event_source_get_userdata(sd_event_source* source) const
+{
+ return ::sd_event_source_get_userdata(source);
+}
+
void* SdEventImpl::sd_event_source_set_userdata(sd_event_source* source,
void* userdata) const
{
diff --git a/src/sdeventplus/internal/sdevent.hpp b/src/sdeventplus/internal/sdevent.hpp
index f90e06b..e69b2fd 100644
--- a/src/sdeventplus/internal/sdevent.hpp
+++ b/src/sdeventplus/internal/sdevent.hpp
@@ -64,6 +64,8 @@
virtual sd_event_source*
sd_event_source_unref(sd_event_source* source) const = 0;
+ virtual void*
+ sd_event_source_get_userdata(sd_event_source* source) const = 0;
virtual void* sd_event_source_set_userdata(sd_event_source* source,
void* userdata) const = 0;
@@ -171,6 +173,7 @@
sd_event_source*
sd_event_source_unref(sd_event_source* source) const override;
+ void* sd_event_source_get_userdata(sd_event_source* source) const override;
void* sd_event_source_set_userdata(sd_event_source* source,
void* userdata) const override;
diff --git a/src/sdeventplus/test/sdevent.hpp b/src/sdeventplus/test/sdevent.hpp
index 366cb67..6e78169 100644
--- a/src/sdeventplus/test/sdevent.hpp
+++ b/src/sdeventplus/test/sdevent.hpp
@@ -57,6 +57,7 @@
MOCK_CONST_METHOD1(sd_event_source_unref,
sd_event_source*(sd_event_source*));
+ MOCK_CONST_METHOD1(sd_event_source_get_userdata, void*(sd_event_source*));
MOCK_CONST_METHOD2(sd_event_source_set_userdata,
void*(sd_event_source*, void*));