mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merge "Replace strdupa with more portable ast_strdupa" into 13
This commit is contained in:
@@ -103,18 +103,6 @@ struct dep_file {
|
|||||||
};
|
};
|
||||||
AST_LIST_HEAD_NOLOCK_STATIC(deps_file, dep_file);
|
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 */
|
/*! \brief return a pointer to the first non-whitespace character */
|
||||||
static inline char *skip_blanks(char *str)
|
static inline char *skip_blanks(char *str)
|
||||||
{
|
{
|
||||||
|
@@ -162,4 +162,16 @@ static inline int strlen_zero(const char *s)
|
|||||||
return (!s || (*s == '\0'));
|
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 */
|
#endif /* MENUSELECT_H */
|
||||||
|
@@ -211,7 +211,7 @@ static void display_mem_info(WINDOW *menu, struct member *mem, int start_y, int
|
|||||||
|
|
||||||
if (mem->displayname) {
|
if (mem->displayname) {
|
||||||
char buf[maxlen + 1];
|
char buf[maxlen + 1];
|
||||||
char *displayname = strdupa(mem->displayname);
|
char *displayname = ast_strdupa(mem->displayname);
|
||||||
char *word;
|
char *word;
|
||||||
int current_line = 1;
|
int current_line = 1;
|
||||||
int new_line = 1;
|
int new_line = 1;
|
||||||
|
Reference in New Issue
Block a user