aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-11-17 14:44:25 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-11-17 14:45:38 +0100
commit7711ef73f32c1eaaa20b4fd5ba1a7b3d9bdcd25d (patch)
tree8d863cb547acf9d1b3e58e35c7600cd07b523b78
parentd41f44875385717cb665059a9ab0d5a632cff0bf (diff)
msgb/embedded: Do not depend on talloc for allocations
We don't want to run talloc on the embedded platform. Use "EMBEDDED" as we don't seem to export TALLOC handling.
-rw-r--r--src/msgb.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/msgb.c b/src/msgb.c
index b2fe1d2c..e779446c 100644
--- a/src/msgb.c
+++ b/src/msgb.c
@@ -33,6 +33,7 @@
//#include <openbsc/gsm_data.h>
#include <osmocom/core/talloc.h>
//#include <openbsc/debug.h>
+#include "config.h"
void *tall_msgb_ctx;
@@ -48,7 +49,11 @@ struct msgb *msgb_alloc(uint16_t size, const char *name)
{
struct msgb *msg;
+#ifdef EMBEDDED
+ msg = malloc(sizeof(*msg) + size);
+#else
msg = _talloc_zero(tall_msgb_ctx, sizeof(*msg) + size, name);
+#endif
if (!msg) {
//LOGP(DRSL, LOGL_FATAL, "unable to allocate msgb\n");
@@ -69,7 +74,11 @@ struct msgb *msgb_alloc(uint16_t size, const char *name)
*/
void msgb_free(struct msgb *m)
{
+#ifdef EMBEDDED
+ free(m);
+#else
talloc_free(m);
+#endif
}
/*! \brief Enqueue message buffer to tail of a queue