Use normal talloc instead of libosmocore copy
diff mbox

Message ID 1413287687-24807-1-git-send-email-max.suraev@fairwaves.co
State Superseded
Headers show

Commit Message

Max Oct. 14, 2014, 11:54 a.m. UTC
Signed-off-by: Max Suraev <max.suraev@fairwaves.co>
---
 configure.ac                |  1 +
 src/Makefile.am             |  2 ++
 src/bitvector.cpp           |  2 +-
 src/bts.cpp                 |  2 +-
 src/gprs_bssgp_pcu.h        |  2 +-
 src/gprs_debug.cpp          |  2 +-
 src/openbts_sock.cpp        |  2 +-
 src/pcu_l1_if.cpp           |  2 +-
 src/sba.cpp                 |  2 +-
 src/sysmo_l1_fwd.c          |  2 +-
 src/sysmo_l1_hw.c           |  2 +-
 src/sysmo_l1_if.c           |  2 +-
 src/sysmo_sock.cpp          |  2 +-
 src/ta.cpp                  |  2 +-
 src/tbf.cpp                 |  2 +-
 src/tbf_dl.cpp              |  2 +-
 src/tbf_ul.cpp              |  2 +-
 tests/Makefile.am           | 13 +++++++++----
 tests/alloc/AllocTest.cpp   |  2 +-
 tests/emu/pcu_emu.cpp       |  2 +-
 tests/rlcmac/RLCMACTest.cpp |  1 +
 tests/tbf/TbfTest.cpp       |  2 +-
 tests/types/TypesTest.cpp   |  2 +-
 23 files changed, 32 insertions(+), 23 deletions(-)

Comments

Jan Engelhardt Oct. 14, 2014, 12:15 p.m. UTC | #1
On Tuesday 2014-10-14 13:54, Max Suraev wrote:
>+++ b/src/bitvector.cpp
>@@ -27,7 +27,7 @@
> 
> #include <bitvector.h>
> extern "C" {
>-#include <osmocom/core/talloc.h>
>+#include <talloc.h>
> }

Mh, it would be better to avoid having #includes inside extern "C",
because you never really know what exactly header files contain.
Instead, each .h file wraps the C functions it has in a
#ifdef __cplusplus / extern "C" {} / #endif block of its own,
just like talloc.h does.

Patch
diff mbox

diff --git a/configure.ac b/configure.ac
index 3b2f380..c72cb4b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,6 +26,7 @@  PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore  >= 0.3.9)
 PKG_CHECK_MODULES(LIBOSMOVTY, libosmovty)
 PKG_CHECK_MODULES(LIBOSMOGSM, libosmogsm >= 0.3.3)
 PKG_CHECK_MODULES(LIBOSMOGB, libosmogb >= 0.5.1.4)
+PKG_CHECK_MODULES(LIBTALLOC, talloc >= 2.0.1)
 
 AC_MSG_CHECKING([whether to enable sysmocom-bts hardware support])
 AC_ARG_ENABLE(sysmocom-bts,
diff --git a/src/Makefile.am b/src/Makefile.am
index d1ed701..8c625ed 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -112,6 +112,7 @@  osmo_pcu_LDADD = \
 	$(LIBOSMOGB_LIBS) \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
+	$(LIBTALLOC_LIBS) \
 	$(COMMON_LA)
 
 if ENABLE_SYSMODSP
@@ -120,6 +121,7 @@  osmo_pcu_remote_LDADD = \
 	$(LIBOSMOGB_LIBS) \
 	$(LIBOSMOCORE_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
+	$(LIBTALLOC_LIBS) \
 	$(COMMON_LA)
 endif
 
diff --git a/src/bitvector.cpp b/src/bitvector.cpp
index 43feebc..bc1bcb0 100644
--- a/src/bitvector.cpp
+++ b/src/bitvector.cpp
@@ -27,7 +27,7 @@ 
 
 #include <bitvector.h>
 extern "C" {
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 }
 
 void *bv_tall_ctx;
diff --git a/src/bts.cpp b/src/bts.cpp
index b660014..d18361e 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -30,7 +30,7 @@ 
 #include <gprs_debug.h>
 
 extern "C" {
-	#include <osmocom/core/talloc.h>
+	#include <talloc.h>
 	#include <osmocom/core/msgb.h>
 }
 
diff --git a/src/gprs_bssgp_pcu.h b/src/gprs_bssgp_pcu.h
index 32b6728..a05ef75 100644
--- a/src/gprs_bssgp_pcu.h
+++ b/src/gprs_bssgp_pcu.h
@@ -23,7 +23,7 @@ 
 
 
 extern "C" {
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 #include <osmocom/core/rate_ctr.h>
 #include <osmocom/core/logging.h>
 #include <osmocom/core/signal.h>
diff --git a/src/gprs_debug.cpp b/src/gprs_debug.cpp
index 6f9e310..aa8864e 100644
--- a/src/gprs_debug.cpp
+++ b/src/gprs_debug.cpp
@@ -25,7 +25,7 @@ 
 #include <time.h>
 #include <errno.h>
 
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 #include <osmocom/core/utils.h>
 #include <osmocom/core/logging.h>
 #include <gprs_debug.h>
diff --git a/src/openbts_sock.cpp b/src/openbts_sock.cpp
index 2d9cae4..50880f3 100644
--- a/src/openbts_sock.cpp
+++ b/src/openbts_sock.cpp
@@ -27,7 +27,7 @@ 
 #include <sys/socket.h>
 #include <arpa/inet.h>
 extern "C" {
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 #include <osmocom/core/write_queue.h>
 #include <osmocom/core/socket.h>
 #include <osmocom/core/timer.h>
diff --git a/src/pcu_l1_if.cpp b/src/pcu_l1_if.cpp
index 0cb79eb..2a81584 100644
--- a/src/pcu_l1_if.cpp
+++ b/src/pcu_l1_if.cpp
@@ -27,7 +27,7 @@ 
 #include <sys/un.h>
 #include <arpa/inet.h>
 extern "C" {
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 #include <osmocom/core/select.h>
 #include <osmocom/core/msgb.h>
 }
diff --git a/src/sba.cpp b/src/sba.cpp
index 6eec235..a0e1506 100644
--- a/src/sba.cpp
+++ b/src/sba.cpp
@@ -25,7 +25,7 @@ 
 #include <bts.h>
 
 extern "C" {
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 }
 
 #include <errno.h>
diff --git a/src/sysmo_l1_fwd.c b/src/sysmo_l1_fwd.c
index 535a7f0..0336889 100644
--- a/src/sysmo_l1_fwd.c
+++ b/src/sysmo_l1_fwd.c
@@ -32,7 +32,7 @@ 
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 #include <osmocom/core/utils.h>
 #include <osmocom/core/select.h>
 #include <osmocom/core/write_queue.h>
diff --git a/src/sysmo_l1_hw.c b/src/sysmo_l1_hw.c
index 8351d68..9190a51 100644
--- a/src/sysmo_l1_hw.c
+++ b/src/sysmo_l1_hw.c
@@ -29,7 +29,7 @@ 
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 #include <osmocom/core/utils.h>
 #include <osmocom/core/select.h>
 #include <osmocom/core/write_queue.h>
diff --git a/src/sysmo_l1_if.c b/src/sysmo_l1_if.c
index 4274e77..fa3a983 100644
--- a/src/sysmo_l1_if.c
+++ b/src/sysmo_l1_if.c
@@ -1,6 +1,7 @@ 
 
 #include <string.h>
 #include <errno.h>
+#include <talloc.h>
 
 #include <sysmocom/femtobts/superfemto.h>
 #include <sysmocom/femtobts/gsml1prim.h>
@@ -8,7 +9,6 @@ 
 #include <sysmocom/femtobts/gsml1types.h>
 
 #include <osmocom/core/gsmtap.h>
-#include <osmocom/core/talloc.h>
 #include <osmocom/core/timer.h>
 #include <sysmo_l1_if.h>
 #include <gprs_debug.h>
diff --git a/src/sysmo_sock.cpp b/src/sysmo_sock.cpp
index 951653e..9b97190 100644
--- a/src/sysmo_sock.cpp
+++ b/src/sysmo_sock.cpp
@@ -26,7 +26,7 @@ 
 #include <sys/socket.h>
 #include <sys/un.h>
 extern "C" {
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 #include <osmocom/core/select.h>
 #include <osmocom/core/msgb.h>
 }
diff --git a/src/ta.cpp b/src/ta.cpp
index 0bc1d66..428f084 100644
--- a/src/ta.cpp
+++ b/src/ta.cpp
@@ -23,7 +23,7 @@ 
 #include <gprs_rlcmac.h>
 
 extern "C" {
-	#include <osmocom/core/talloc.h>
+	#include <talloc.h>
 }
 
 #include <errno.h>
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 2afe257..a688421 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -30,7 +30,7 @@ 
 
 extern "C" {
 #include <osmocom/core/msgb.h>
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 }
 
 #include <errno.h>
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 8de3b2b..369a5cb 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -29,7 +29,7 @@ 
 
 extern "C" {
 #include <osmocom/core/msgb.h>
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 }
 
 #include <errno.h>
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index 3ab71f0..a5a0d2f 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -30,7 +30,7 @@ 
 
 extern "C" {
 #include <osmocom/core/msgb.h>
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 }
 
 #include <errno.h>
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e84f17d..84039a2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,6 +7,7 @@  rlcmac_RLCMACTest_SOURCES = rlcmac/RLCMACTest.cpp
 rlcmac_RLCMACTest_LDADD = \
 	$(top_builddir)/src/libgprs.la \
 	$(LIBOSMOCORE_LIBS) \
+	$(LIBTALLOC_LIBS) \
 	$(COMMON_LA)
 
 alloc_AllocTest_SOURCES = alloc/AllocTest.cpp
@@ -15,15 +16,17 @@  alloc_AllocTest_LDADD = \
 	$(LIBOSMOGB_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOCORE_LIBS) \
+	$(LIBTALLOC_LIBS) \
 	$(COMMON_LA)
 
 tbf_TbfTest_SOURCES = tbf/TbfTest.cpp
 tbf_TbfTest_LDADD = \
+	$(top_builddir)/src/libgprs.la \
 	$(LIBOSMOGB_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOCORE_LIBS) \
-	$(COMMON_LA) \
-	$(top_builddir)/src/libgprs.la
+	$(LIBTALLOC_LIBS) \
+	$(COMMON_LA)
 
 emu_pcu_emu_SOURCES = emu/pcu_emu.cpp emu/test_replay_gprs_attach.cpp \
 	emu/openbsc_clone.c emu/openbsc_clone.h emu/gprs_tests.h \
@@ -33,15 +36,17 @@  emu_pcu_emu_LDADD = \
 	$(LIBOSMOGB_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOCORE_LIBS) \
+	$(LIBTALLOC_LIBS) \
 	$(COMMON_LA)
 
 types_TypesTest_SOURCES = types/TypesTest.cpp
 types_TypesTest_LDADD = \
+	$(top_builddir)/src/libgprs.la \
 	$(LIBOSMOGB_LIBS) \
 	$(LIBOSMOGSM_LIBS) \
 	$(LIBOSMOCORE_LIBS) \
-	$(COMMON_LA) \
-	$(top_builddir)/src/libgprs.la
+	$(LIBTALLOC_LIBS) \
+	$(COMMON_LA)
 
 
 # The `:;' works around a Bash 3.2 bug when the output is not writeable.
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index d711ad8..012bb47 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -28,8 +28,8 @@ 
 extern "C" {
 #include <osmocom/core/application.h>
 #include <osmocom/core/msgb.h>
-#include <osmocom/core/talloc.h>
 #include <osmocom/core/utils.h>
+#include <talloc.h>
 }
 
 /* globals used by the code */
diff --git a/tests/emu/pcu_emu.cpp b/tests/emu/pcu_emu.cpp
index ed0abbe..0a9ecbd 100644
--- a/tests/emu/pcu_emu.cpp
+++ b/tests/emu/pcu_emu.cpp
@@ -20,7 +20,7 @@ 
  */
 
 extern "C" {
-#include <osmocom/core/talloc.h>
+#include <talloc.h>
 #include <pcu_vty.h>
 }
 
diff --git a/tests/rlcmac/RLCMACTest.cpp b/tests/rlcmac/RLCMACTest.cpp
index 66bc53c..987d3e9 100644
--- a/tests/rlcmac/RLCMACTest.cpp
+++ b/tests/rlcmac/RLCMACTest.cpp
@@ -28,6 +28,7 @@ 
 extern "C" {
 extern const struct log_info gprs_log_info;
 #include "pcu_vty.h"
+#include <talloc.h>
 #include <osmocom/vty/telnet_interface.h>
 #include <osmocom/vty/logging.h>
 #include <osmocom/core/application.h>
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index 0811520..c62a74c 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -27,8 +27,8 @@ 
 extern "C" {
 #include <osmocom/core/application.h>
 #include <osmocom/core/msgb.h>
-#include <osmocom/core/talloc.h>
 #include <osmocom/core/utils.h>
+#include <talloc.h>
 }
 
 void *tall_pcu_ctx;
diff --git a/tests/types/TypesTest.cpp b/tests/types/TypesTest.cpp
index 8a464b1..9ceae77 100644
--- a/tests/types/TypesTest.cpp
+++ b/tests/types/TypesTest.cpp
@@ -28,8 +28,8 @@ 
 extern "C" {
 #include <osmocom/core/application.h>
 #include <osmocom/core/msgb.h>
-#include <osmocom/core/talloc.h>
 #include <osmocom/core/utils.h>
+#include <talloc.h>
 }
 
 #define OSMO_ASSERT_STR_EQ(a, b) \