From d7f15ac7306a80fee78631d6ff2d736d125f6414 Mon Sep 17 00:00:00 2001 From: waker Date: Fri, 30 Aug 2013 20:19:26 +0200 Subject: moved all copies of strdupa macro to strdupa.h --- strdupa.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 strdupa.h (limited to 'strdupa.h') diff --git a/strdupa.h b/strdupa.h new file mode 100644 index 00000000..00a94cb6 --- /dev/null +++ b/strdupa.h @@ -0,0 +1,18 @@ +#ifndef __DDB_PLATFORM_H +#define __DDB_PLATFORM_H + +#include + +#ifndef _GNU_SOURCE +#ifndef strdupa +# define strdupa(s) \ + ({ \ + const char *old = (s); \ + size_t len = strlen (old) + 1; \ + char *new = (char *) alloca (len); \ + (char *) memcpy (new, old, len); \ + }) +#endif +#endif + +#endif -- cgit v1.2.3