The strdupa function is a GNU extension, and not widely portable. We
have an ast_strdupa function used within Asterisk which is preferred.
I pulled the definition up from menuselect.c into the menuselect.h
header file so it can be shared across menuselect.
Change-Id: I9593c97f78386b47dc1e83201e80cb2f62b36c2e
};
AST_LIST_HEAD_NOLOCK_STATIC(deps_file, dep_file);
-#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)
{
return (!s || (*s == '\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
+
#endif /* MENUSELECT_H */
if (mem->displayname) {
char buf[maxlen + 1];
- char *displayname = strdupa(mem->displayname);
+ char *displayname = ast_strdupa(mem->displayname);
char *word;
int current_line = 1;
int new_line = 1;