diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-05-17 21:06:51 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2019-05-18 11:08:40 +0200 |
commit | 5f46605aeecab35729cf843493e6fa3549e16d9e (patch) | |
tree | d5a2da91918a733459f0016f7ee55cd827507c90 | |
parent | 753ae497c7e5aefb8ba94444e099ab91e6722182 (diff) |
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
-rw-r--r-- | src/pseudotalloc/pseudotalloc.c | 2 | ||||
-rw-r--r-- | src/pseudotalloc/talloc.h | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/pseudotalloc/pseudotalloc.c b/src/pseudotalloc/pseudotalloc.c index 89e62696..c368296c 100644 --- a/src/pseudotalloc/pseudotalloc.c +++ b/src/pseudotalloc/pseudotalloc.c @@ -97,7 +97,7 @@ char *talloc_asprintf(const void *ctx, const char *fmt, ...) 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 34088af0..fe2efbcf 100644 --- a/src/pseudotalloc/talloc.h +++ b/src/pseudotalloc/talloc.h @@ -60,5 +60,6 @@ void *_talloc_zero_array(const void *ctx, 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); |