[PATCH libevdev] Rename symbols leaking from static library to avoid name clashes

Peter Hutterer peter.hutterer at who-t.net
Sun Aug 17 21:08:10 PDT 2014


The static library currently leaks log_msg and log_priority. Both are too
generic, so rename them with a leading underscore to hint they're supposed to
be private.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Anyone got good ideas on how to hide symbols from a static lib I'm all ears.
All the stuff I found via google seemed somewhat hacky but I can't believe
no-one else has had that problem so far.

Cheers,
   Peter

 libevdev/libevdev-int.h | 14 +++++++-------
 libevdev/libevdev.c     | 10 +++++-----
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/libevdev/libevdev-int.h b/libevdev/libevdev-int.h
index c184434..5e5ab26 100644
--- a/libevdev/libevdev-int.h
+++ b/libevdev/libevdev-int.h
@@ -126,8 +126,8 @@ struct libevdev {
 
 #define log_msg_cond(dev, priority, ...) \
 	do { \
-		if (log_priority(dev) >= priority) \
-			log_msg(dev, priority, __FILE__, __LINE__, __func__, __VA_ARGS__); \
+		if (_libevdev_log_priority(dev) >= priority) \
+			_libevdev_log_msg(dev, priority, __FILE__, __LINE__, __func__, __VA_ARGS__); \
 	} while(0)
 
 #define log_error(dev, ...) log_msg_cond(dev, LIBEVDEV_LOG_ERROR, __VA_ARGS__)
@@ -136,12 +136,12 @@ struct libevdev {
 #define log_bug(dev, ...) log_msg_cond(dev, LIBEVDEV_LOG_ERROR, "BUG: "__VA_ARGS__)
 
 extern void
-log_msg(const struct libevdev *dev,
-	enum libevdev_log_priority priority,
-	const char *file, int line, const char *func,
-	const char *format, ...) LIBEVDEV_ATTRIBUTE_PRINTF(6, 7);
+_libevdev_log_msg(const struct libevdev *dev,
+		  enum libevdev_log_priority priority,
+		  const char *file, int line, const char *func,
+		  const char *format, ...) LIBEVDEV_ATTRIBUTE_PRINTF(6, 7);
 extern enum libevdev_log_priority
-log_priority(const struct libevdev *dev);
+_libevdev_log_priority(const struct libevdev *dev);
 
 /**
  * @return a pointer to the next element in the queue, or NULL if the queue
diff --git a/libevdev/libevdev.c b/libevdev/libevdev.c
index 903a286..6831e68 100644
--- a/libevdev/libevdev.c
+++ b/libevdev/libevdev.c
@@ -136,10 +136,10 @@ static struct logdata log_data = {
 };
 
 void
-log_msg(const struct libevdev *dev,
-	enum libevdev_log_priority priority,
-	const char *file, int line, const char *func,
-	const char *format, ...)
+_libevdev_log_msg(const struct libevdev *dev,
+		  enum libevdev_log_priority priority,
+		  const char *file, int line, const char *func,
+		  const char *format, ...)
 {
 	va_list args;
 
@@ -275,7 +275,7 @@ libevdev_set_device_log_function(struct libevdev *dev,
 }
 
 enum libevdev_log_priority
-log_priority(const struct libevdev *dev)
+_libevdev_log_priority(const struct libevdev *dev)
 {
 	if (dev && dev->log.device_handler)
 		return dev->log.priority;
-- 
1.9.3



More information about the Input-tools mailing list