[MERGED] libosmocore[master]: logging: remove code duplication

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Mon Jan 16 14:12:13 UTC 2017


Max has submitted this change and it was merged.

Change subject: logging: remove code duplication
......................................................................


logging: remove code duplication

* make DEBUGP* macro into simple wrappers around LOGP*
* deprecate unused logp() function

Related: OS#71
Change-Id: Ia6c92bd4824c44fc22cc733ce7a88da86e58ed93
---
M include/osmocom/core/logging.h
1 file changed, 4 insertions(+), 13 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Harald Welte: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index fe9ae93..fcf77f0 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -10,6 +10,7 @@
 #include <stdint.h>
 #include <stdarg.h>
 #include <stdbool.h>
+#include <osmocom/core/defs.h>
 #include <osmocom/core/linuxlist.h>
 
 /*! \brief Maximum number of logging contexts */
@@ -25,18 +26,8 @@
  *  \param[in] fmt format string
  *  \param[in] args variable argument list
  */
-#define DEBUGP(ss, fmt, args...) \
-	do { \
-		if (log_check_level(ss, LOGL_DEBUG)) \
-			logp(ss, __BASE_FILE__, __LINE__, 0, fmt, ## args); \
-	} while(0)
-
-#define DEBUGPC(ss, fmt, args...) \
-	do { \
-		if (log_check_level(ss, LOGL_DEBUG)) \
-			logp(ss, __BASE_FILE__, __LINE__, 1, fmt, ## args); \
-	} while(0)
-
+#define DEBUGP(ss, fmt, args...) LOGP(ss, LOGL_DEBUG, fmt, ##args)
+#define DEBUGPC(ss, fmt, args...) LOGPC(ss, LOGL_DEBUG, fmt, ##args)
 #else
 #define DEBUGP(xss, fmt, args...)
 #define DEBUGPC(ss, fmt, args...)
@@ -46,7 +37,7 @@
 void osmo_vlogp(int subsys, int level, const char *file, int line,
 		int cont, const char *format, va_list ap);
 
-void logp(int subsys, const char *file, int line, int cont, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
+void logp(int subsys, const char *file, int line, int cont, const char *format, ...) OSMO_DEPRECATED("Use DEBUGP* macros instead");
 
 /*! \brief Log a new message through the Osmocom logging framework
  *  \param[in] ss logging subsystem (e.g. \ref DLGLOBAL)

-- 
To view, visit https://gerrit.osmocom.org/1580
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia6c92bd4824c44fc22cc733ce7a88da86e58ed93
Gerrit-PatchSet: 3
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list