Change in libosmocore[master]: pseudotalloc: turn talloc_steal() into #define

Harald Welte gerrit-no-reply at lists.osmocom.org
Sun May 19 07:14:13 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/14079 )

Change subject: pseudotalloc: turn talloc_steal() into #define
......................................................................

pseudotalloc: turn talloc_steal() into #define

Any non-anciant version of talloc implements talloc_steal()
as a #define using the _talloc_steal_loc() symbol.  Let's be
more compatible.

This fix is relevant to using osmo_fsm inside the osmo-ccid-firmware
builds for Cortex-M4.  In this situation, for some strange reason,
libosmcoore is compiled using src/pseudotalloc/talloc.h, but later then
linked against the real libtalloc.

Change-Id: I1ee7f5e9b1002cff37bb8341ad870e1da5f1f9ff
---
M src/pseudotalloc/pseudotalloc.c
M src/pseudotalloc/talloc.h
2 files changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/pseudotalloc/pseudotalloc.c b/src/pseudotalloc/pseudotalloc.c
index 89e6269..c368296 100644
--- a/src/pseudotalloc/pseudotalloc.c
+++ b/src/pseudotalloc/pseudotalloc.c
@@ -97,7 +97,7 @@
 	return buf;
 }
 
-void *talloc_steal(const void *new_ctx, const void *obj)
+void *_talloc_steal_loc(const void *new_ctx, const void *obj, const char *location)
 {
 	/* as we don't do hierarchical allocations, this is simply a NOP */
 	return (void *)obj;
diff --git a/src/pseudotalloc/talloc.h b/src/pseudotalloc/talloc.h
index 34088af..fe2efbc 100644
--- a/src/pseudotalloc/talloc.h
+++ b/src/pseudotalloc/talloc.h
@@ -60,5 +60,6 @@
 			 const char *name);
 char *talloc_asprintf(const void *ctx, const char *fmt, ...);
 
-void *talloc_steal(const void *new_ctx, const void *obj);
+#define talloc_steal(ctx, ptr) _talloc_steal_loc((ctx), (ptr), __location__)
+void *_talloc_steal_loc(const void *new_ctx, const void *obj, const char *location);
 char *talloc_vasprintf(const void *t, const char *fmt, va_list ap);

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1ee7f5e9b1002cff37bb8341ad870e1da5f1f9ff
Gerrit-Change-Number: 14079
Gerrit-PatchSet: 2
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190519/95a71dab/attachment.html>


More information about the gerrit-log mailing list