From 14c4c498b15485c35abf6fb8ec54eb1e0724bae6 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 28 Jun 2018 08:28:52 +0200 Subject: Fix embedded (arm-none-eabi) builds Due to OS#3360, build testing for arm-none-eabi was unfortunately skipped for a long time. This is a number of fixes that make the compile test pass again. Related: OS#3360 Change-Id: I88e3c8e1a8786ca2a6a023b0d27c74be200a8588 --- src/pseudotalloc/pseudotalloc.c | 16 ++++++++++++++++ src/pseudotalloc/talloc.h | 3 +++ 2 files changed, 19 insertions(+) (limited to 'src/pseudotalloc') diff --git a/src/pseudotalloc/pseudotalloc.c b/src/pseudotalloc/pseudotalloc.c index 2a990663..89e62696 100644 --- a/src/pseudotalloc/pseudotalloc.c +++ b/src/pseudotalloc/pseudotalloc.c @@ -96,3 +96,19 @@ char *talloc_asprintf(const void *ctx, const char *fmt, ...) va_end(args); return buf; } + +void *talloc_steal(const void *new_ctx, const void *obj) +{ + /* as we don't do hierarchical allocations, this is simply a NOP */ + return (void *)obj; +} + +char *talloc_vasprintf(const void *t, const char *fmt, va_list ap) +{ + /* we have a hard-coded maximum string length of 128 bytes in this pseudo implementation */ + char *buf = pseudotalloc_malloc(128); + if (!buf) + return NULL; + vsnprintf(buf, 128, fmt, ap); + return buf; +} diff --git a/src/pseudotalloc/talloc.h b/src/pseudotalloc/talloc.h index ae2e1fc8..34088af0 100644 --- a/src/pseudotalloc/talloc.h +++ b/src/pseudotalloc/talloc.h @@ -59,3 +59,6 @@ void *_talloc_zero_array(const void *ctx, unsigned count, const char *name); char *talloc_asprintf(const void *ctx, const char *fmt, ...); + +void *talloc_steal(const void *new_ctx, const void *obj); +char *talloc_vasprintf(const void *t, const char *fmt, va_list ap); -- cgit v1.2.3