Signed-off-by: Michael Olbrich <m.olbrich@xxxxxxxxxxxxxx> --- include/xfuncs.h | 5 +++++ lib/xfuncs.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/xfuncs.h b/include/xfuncs.h index c7c0203f375b..b53cfdcddd31 100644 --- a/include/xfuncs.h +++ b/include/xfuncs.h @@ -3,6 +3,7 @@ #include <linux/types.h> #include <stdarg.h> +#include <wchar.h> void *xmalloc(size_t size); void *xrealloc(void *ptr, size_t size); @@ -13,4 +14,8 @@ void* xmemdup(const void *orig, size_t size); char *xasprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); char *xvasprintf(const char *fmt, va_list ap); +wchar_t *xstrdup_wchar(const wchar_t *src); +wchar_t *xstrdup_char_to_wchar(const char *src); +char *xstrdup_wchar_to_char(const wchar_t *src); + #endif /* __XFUNCS_H */ diff --git a/lib/xfuncs.c b/lib/xfuncs.c index ce89169547a4..c8c1da7dad7f 100644 --- a/lib/xfuncs.c +++ b/lib/xfuncs.c @@ -22,6 +22,7 @@ #include <common.h> #include <malloc.h> #include <module.h> +#include <wchar.h> void *xmalloc(size_t size) { @@ -105,3 +106,33 @@ char *xasprintf(const char *fmt, ...) return p; } EXPORT_SYMBOL(xasprintf); + +wchar_t *xstrdup_wchar(const wchar_t *s) +{ + wchar_t *p = strdup_wchar(s); + + if (!p) + panic("ERROR: out of memory\n"); + return p; +} +EXPORT_SYMBOL(xstrdup_wchar); + +wchar_t *xstrdup_char_to_wchar(const char *s) +{ + wchar_t *p = strdup_char_to_wchar(s); + + if (!p) + panic("ERROR: out of memory\n"); + return p; +} +EXPORT_SYMBOL(xstrdup_char_to_wchar); + +char *xstrdup_wchar_to_char(const wchar_t *s) +{ + char *p = strdup_wchar_to_char(s); + + if (!p) + panic("ERROR: out of memory\n"); + return p; +} +EXPORT_SYMBOL(xstrdup_wchar_to_char); -- 2.1.4 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox