Change in ...libosmocore[master]: minor: don't redefine macros

2019-06-13 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14434 )

Change subject: minor: don't redefine macros
..

minor: don't redefine macros

the DEBUG macro name and ARRAY_SIZE macro function are frequently
used in other projects. If these projects also use libosmocore,
the macros will be redefined. This also generates a warning message
during compilation.
Not redefining the macros removes the warning message and possible
(but unlikely) mis-redefinition.

Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c
---
M include/osmocom/core/logging.h
M include/osmocom/core/utils.h
2 files changed, 4 insertions(+), 0 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 295e5a8..803b4a9 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -16,7 +16,9 @@
 /*! Maximum number of logging filters */
 #define LOG_MAX_FILTERS8

+#ifndef DEBUG
 #define DEBUG
+#endif

 #ifdef DEBUG
 /*! Log a debug message through the Osmocom logging framework
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index f429ba6..0673444 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -14,7 +14,9 @@
  * \file utils.h */

 /*! Determine number of elements in an array of static size */
+#ifndef ARRAY_SIZE
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
 /*! Return the maximum of two specified values */
 #define OSMO_MAX(a, b) ((a) >= (b) ? (a) : (b))
 /*! Return the minimum of two specified values */

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14434
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c
Gerrit-Change-Number: 14434
Gerrit-PatchSet: 2
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-MessageType: merged


Change in ...libosmocore[master]: minor: don't redefine macros

2019-06-13 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14434 )

Change subject: minor: don't redefine macros
..


Patch Set 1: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14434
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c
Gerrit-Change-Number: 14434
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Thu, 13 Jun 2019 13:49:00 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...libosmocore[master]: minor: don't redefine macros

2019-06-13 Thread Kévin Redon
Kévin Redon has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/14434


Change subject: minor: don't redefine macros
..

minor: don't redefine macros

the DEBUG macro name and ARRAY_SIZE macro function are frequently
used in other projects. If these projects also use libosmocore,
the macros will be redefined. This also generates a warning message
during compilation.
Not redefining the macros removes the warning message and possible
(but unlikely) mis-redefinition.

Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c
---
M include/osmocom/core/logging.h
M include/osmocom/core/utils.h
2 files changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/34/14434/1

diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 295e5a8..803b4a9 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -16,7 +16,9 @@
 /*! Maximum number of logging filters */
 #define LOG_MAX_FILTERS8

+#ifndef DEBUG
 #define DEBUG
+#endif

 #ifdef DEBUG
 /*! Log a debug message through the Osmocom logging framework
diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index f27359c..8cf4afb 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -14,7 +14,9 @@
  * \file utils.h */

 /*! Determine number of elements in an array of static size */
+#ifndef ARRAY_SIZE
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
 /*! Return the maximum of two specified values */
 #define OSMO_MAX(a, b) ((a) >= (b) ? (a) : (b))
 /*! Return the minimum of two specified values */

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14434
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I0ba91eae8eacc5542d1647601b372e417ed1713c
Gerrit-Change-Number: 14434
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon 
Gerrit-MessageType: newchange