aboutsummaryrefslogtreecommitdiffstats
path: root/build_tools
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-06-19 14:24:35 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-06-19 14:24:35 +0000
commita828f10fa41160c9df18beb953fa963687914b44 (patch)
tree50b189049244909dc84551b3626c1316bdf34199 /build_tools
parentcf81182b8b790e0716f28fdb478b6bd99c2db81d (diff)
copy the definition of ast_strdupa and use it instead of strdupa to fix the
build on systems that don't have it, such as mac git-svn-id: http://svn.digium.com/svn/asterisk/trunk@34818 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'build_tools')
-rw-r--r--build_tools/menuselect.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/build_tools/menuselect.c b/build_tools/menuselect.c
index 62be208f7..3388ccf0d 100644
--- a/build_tools/menuselect.c
+++ b/build_tools/menuselect.c
@@ -70,6 +70,18 @@ static int existing_config = 0;
/*! This is set when the --check-deps argument is provided. */
static int check_deps = 0;
+#if !defined(ast_strdupa) && defined(__GNUC__)
+#define ast_strdupa(s) \
+ (__extension__ \
+ ({ \
+ const char *__old = (s); \
+ size_t __len = strlen(__old) + 1; \
+ char *__new = __builtin_alloca(__len); \
+ memcpy (__new, __old, __len); \
+ __new; \
+ }))
+#endif
+
/*! \brief return a pointer to the first non-whitespace character */
static inline char *skip_blanks(char *str)
{
@@ -516,7 +528,7 @@ static int generate_makeopts_file(void)
had_changes = 1;
if (mem->remove_on_change) {
- for (buf = strdupa(mem->remove_on_change), file = strsep(&buf, " ");
+ for (buf = ast_strdupa(mem->remove_on_change), file = strsep(&buf, " ");
file;
file = strsep(&buf, " "))
unlink(file);
@@ -524,7 +536,7 @@ static int generate_makeopts_file(void)
}
if (cat->remove_on_change && had_changes) {
- for (buf = strdupa(cat->remove_on_change), file = strsep(&buf, " ");
+ for (buf = ast_strdupa(cat->remove_on_change), file = strsep(&buf, " ");
file;
file = strsep(&buf, " "))
unlink(file);