[vlc-commits] src: remove a bunch of !__linux__ preprocessor

Rémi Denis-Courmont git at videolan.org
Mon Feb 12 18:45:50 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Feb 12 19:26:12 2018 +0200| [ea81c71c730605ea3a5ffb97a42d2500cb05844c] | committer: Rémi Denis-Courmont

src: remove a bunch of !__linux__ preprocessor

The portable code won't be linked on Linux, but at least it will be
compiled - reducing developer errors.

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

 src/misc/cpu.c     | 4 +---
 src/posix/dirs.c   | 6 ++----
 src/posix/thread.c | 4 +---
 3 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/misc/cpu.c b/src/misc/cpu.c
index 9bce85c990..56010e60b7 100644
--- a/src/misc/cpu.c
+++ b/src/misc/cpu.c
@@ -37,7 +37,6 @@
 
 #include <assert.h>
 
-#ifndef __linux__
 #include <sys/types.h>
 #ifndef _WIN32
 #include <unistd.h>
@@ -266,13 +265,12 @@ out:
 /**
  * Retrieves pre-computed CPU capability flags
  */
-unsigned vlc_CPU (void)
+VLC_WEAK unsigned vlc_CPU(void)
 {
     static vlc_once_t once = VLC_STATIC_ONCE;
     vlc_once(&once, vlc_CPU_init);
     return cpu_flags;
 }
-#endif
 
 void vlc_CPU_dump (vlc_object_t *obj)
 {
diff --git a/src/posix/dirs.c b/src/posix/dirs.c
index cfa1f22440..59d36787ab 100644
--- a/src/posix/dirs.c
+++ b/src/posix/dirs.c
@@ -35,13 +35,12 @@
 #include <assert.h>
 #include <limits.h>
 
-#if !defined (__linux__)
 /**
  * Determines the shared data directory
  *
  * @return a nul-terminated string or NULL. Use free() to release it.
  */
-char *config_GetDataDir (void)
+VLC_WEAK char *config_GetDataDir(void)
 {
     const char *path = getenv ("VLC_DATA_PATH");
     return strdup ((path != NULL) ? path : PKGDATADIR);
@@ -52,12 +51,11 @@ char *config_GetDataDir (void)
  *
  * @return a string (always succeeds).
  */
-char *config_GetLibDir (void)
+VLC_WEAK char *config_GetLibDir(void)
 {
     const char *path = getenv("VLC_LIB_PATH");
     return strdup((path != NULL) ? path : PKGLIBDIR);
 }
-#endif
 
 static char *config_GetHomeDir (void)
 {
diff --git a/src/posix/thread.c b/src/posix/thread.c
index 352b37d871..e849abc5bb 100644
--- a/src/posix/thread.c
+++ b/src/posix/thread.c
@@ -556,12 +556,10 @@ vlc_thread_t vlc_thread_self (void)
     return thread;
 }
 
-#if !defined (__linux__)
-unsigned long vlc_thread_id (void)
+VLC_WEAK unsigned long vlc_thread_id(void)
 {
      return -1;
 }
-#endif
 
 int vlc_set_priority (vlc_thread_t th, int priority)
 {



More information about the vlc-commits mailing list