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: https://origsvn.digium.com/svn/asterisk/trunk@34818 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant 2006-06-19 14:24:35 +00:00
parent 2302fa58d7
commit aa8efe1783
1 changed files with 14 additions and 2 deletions

View File

@ -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);