From 982c8e146504378d2e988d8f9a4ea4ef591c5470 Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Wed, 10 Jan 2007 19:02:58 +0000 Subject: Return the useless casts that ensure this file is C++ clean. (issue #8602 reported by mikma) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@50397 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/strings.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index c91ecaec3..d45a7cd22 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -32,6 +32,8 @@ #include "asterisk/utils.h" #include "asterisk/threadstorage.h" +/* You may see casts in this header that may seem useless but they ensure this file is C++ clean */ + static force_inline int ast_strlen_zero(const char *s) { return (!s || (*s == '\0')); @@ -333,7 +335,7 @@ struct ast_str * attribute_malloc ast_str_create(size_t init_len), { struct ast_str *buf; - buf = ast_calloc(1, sizeof(*buf) + init_len); + buf = (struct ast_str *)ast_calloc(1, sizeof(*buf) + init_len); if (buf == NULL) return NULL; @@ -373,7 +375,7 @@ int ast_str_make_space(struct ast_str **buf, size_t new_len), return 0; /* success */ if ((*buf)->ts == DS_ALLOCA || (*buf)->ts == DS_STATIC) return -1; /* cannot extend */ - *buf = ast_realloc(*buf, new_len + sizeof(struct ast_str)); + *buf = (struct ast_str *)ast_realloc(*buf, new_len + sizeof(struct ast_str)); if (*buf == NULL) /* XXX watch out, we leak memory here */ return -1; if ((*buf)->ts != DS_MALLOC) { @@ -438,7 +440,7 @@ struct ast_str *ast_str_thread_get(struct ast_threadstorage *ts, { struct ast_str *buf; - buf = ast_threadstorage_get(ts, sizeof(*buf) + init_len); + buf = (struct ast_str *)ast_threadstorage_get(ts, sizeof(*buf) + init_len); if (buf == NULL) return NULL; @@ -458,7 +460,7 @@ struct ast_str *__ast_str_thread_get(struct ast_threadstorage *ts, { struct ast_str *buf; - buf = __ast_threadstorage_get(ts, sizeof(*buf) + init_len, file, function, line); + buf = (struct ast_str *)__ast_threadstorage_get(ts, sizeof(*buf) + init_len, file, function, line); if (buf == NULL) return NULL; -- cgit v1.2.3