[vlc-commits] mtime: inline date_Get() and date_Set()

Rémi Denis-Courmont git at videolan.org
Wed May 2 18:06:49 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed May  2 19:00:30 2018 +0300| [7155cebc7bc73f9273e17450e3df4ef62f3395cc] | committer: Rémi Denis-Courmont

mtime: inline date_Get() and date_Set()

Avoid trivial functions located in separate libraries.
Since the layout of date_t is public anyway, this costs nothing.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7155cebc7bc73f9273e17450e3df4ef62f3395cc
---

 include/vlc_mtime.h | 11 +++++++++--
 src/libvlccore.sym  |  2 --
 src/misc/mtime.c    | 11 -----------
 3 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/include/vlc_mtime.h b/include/vlc_mtime.h
index d6f9ab8a85..3c6dd4a2e0 100644
--- a/include/vlc_mtime.h
+++ b/include/vlc_mtime.h
@@ -88,7 +88,11 @@ VLC_API void date_Change(date_t *restrict date, uint32_t num, uint32_t den);
  * \param date date to set the timestamp into
  * \param value date value
  */
-VLC_API void date_Set(date_t *restrict date, mtime_t value);
+static inline void date_Set(date_t *restrict date, mtime_t value)
+{
+    date->date = value;
+    date->i_remainder = 0;
+}
 
 /**
  * Gets the current timestamp from a date_t.
@@ -96,7 +100,10 @@ VLC_API void date_Set(date_t *restrict date, mtime_t value);
  * \param date date to fetch the timestamp from
  * \return date value
  */
-VLC_API mtime_t date_Get(const date_t *restrict date) VLC_USED;
+VLC_USED static inline mtime_t date_Get(const date_t *restrict date)
+{
+    return date->date;
+}
 
 /**
  * Increments a date.
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 725472b084..89d69b85f5 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -69,10 +69,8 @@ config_StringEscape
 config_StringUnescape
 date_Change
 date_Decrement
-date_Get
 date_Increment
 date_Init
-date_Set
 decoder_AbortPictures
 decoder_GetDisplayDate
 decoder_GetDisplayRate
diff --git a/src/misc/mtime.c b/src/misc/mtime.c
index ca289d32e4..2087516957 100644
--- a/src/misc/mtime.c
+++ b/src/misc/mtime.c
@@ -92,17 +92,6 @@ void date_Change( date_t *p_date, uint32_t i_divider_n, uint32_t i_divider_d )
     p_date->i_divider_den = i_divider_d;
 }
 
-void date_Set( date_t *p_date, mtime_t i_new_date )
-{
-    p_date->date = i_new_date;
-    p_date->i_remainder = 0;
-}
-
-mtime_t date_Get( const date_t *p_date )
-{
-    return p_date->date;
-}
-
 mtime_t date_Increment( date_t *p_date, uint32_t i_nb_samples )
 {
     assert( p_date->i_divider_num != 0 );



More information about the vlc-commits mailing list