aboutsummaryrefslogtreecommitdiffstats
path: root/include/asterisk/utils.h
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-13 18:38:55 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-01-13 18:38:55 +0000
commitc68a2d2d8eeae4700c5d8aca778baebd63261010 (patch)
tree5a94467aed03520611a253029bd57ee366f338e5 /include/asterisk/utils.h
parentf94feca2c56f917573ddbfe2138f3cc6bb6e30fa (diff)
Various cleanups from comments in an email from Luigi Rizzo. Thank you!
- Use a cleaner syntax for declaring the allocation macros - Fix return value for ast_strdup/ast_strndup - remove safe_strdup from app_macro, since ast_strup does the same thing - fix a place in app_queue where ast_calloc+strncpy was used instead of ast_strdup. If you are helping out with these conversions, please watch out for other places where this is done. - add a note to the coding guidelines about the fix to app_queue git-svn-id: http://svn.digium.com/svn/asterisk/trunk@8065 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include/asterisk/utils.h')
-rw-r--r--include/asterisk/utils.h24
1 files changed, 7 insertions, 17 deletions
diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h
index ed842e1b7..9c09fe8da 100644
--- a/include/asterisk/utils.h
+++ b/include/asterisk/utils.h
@@ -252,9 +252,7 @@ long int ast_random(void);
The argument and return value are the same as malloc()
*/
#define ast_malloc(len) \
- ({ \
- (_ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _ast_malloc((len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
void *_ast_malloc(size_t len, const char *file, int lineno, const char *func),
@@ -279,9 +277,7 @@ void *_ast_malloc(size_t len, const char *file, int lineno, const char *func),
The arguments and return value are the same as calloc()
*/
#define ast_calloc(num, len) \
- ({ \
- (_ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _ast_calloc((num), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
void *_ast_calloc(size_t num, size_t len, const char *file, int lineno, const char *func),
@@ -306,9 +302,7 @@ void *_ast_calloc(size_t num, size_t len, const char *file, int lineno, const ch
The arguments and return value are the same as realloc()
*/
#define ast_realloc(p, len) \
- ({ \
- (_ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _ast_realloc((p), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
void *_ast_realloc(void *p, size_t len, const char *file, int lineno, const char *func),
@@ -337,12 +331,10 @@ void *_ast_realloc(void *p, size_t len, const char *file, int lineno, const char
The argument and return value are the same as strdup()
*/
#define ast_strdup(str) \
- ({ \
- (_ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _ast_strdup((str), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-void *_ast_strdup(const char *str, const char *file, int lineno, const char *func),
+char *_ast_strdup(const char *str, const char *file, int lineno, const char *func),
{
char *newstr = NULL;
@@ -370,12 +362,10 @@ void *_ast_strdup(const char *str, const char *file, int lineno, const char *fun
The arguments and return value are the same as strndup()
*/
#define ast_strndup(str, len) \
- ({ \
- (_ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)); \
- })
+ _ast_strndup((str), (len), __FILE__, __LINE__, __PRETTY_FUNCTION__)
AST_INLINE_API(
-void *_ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func),
+char *_ast_strndup(const char *str, size_t len, const char *file, int lineno, const char *func),
{
char *newstr = NULL;