[asterisk-commits] file: trunk r50397 - /trunk/include/asterisk/strings.h

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 10 12:02:59 MST 2007


Author: file
Date: Wed Jan 10 13:02:58 2007
New Revision: 50397

URL: http://svn.digium.com/view/asterisk?view=rev&rev=50397
Log:
Return the useless casts that ensure this file is C++ clean. (issue #8602 reported by mikma)

Modified:
    trunk/include/asterisk/strings.h

Modified: trunk/include/asterisk/strings.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/strings.h?view=diff&rev=50397&r1=50396&r2=50397
==============================================================================
--- trunk/include/asterisk/strings.h (original)
+++ trunk/include/asterisk/strings.h Wed Jan 10 13:02:58 2007
@@ -31,6 +31,8 @@
 #include "asterisk/compat.h"
 #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)
 {
@@ -333,7 +335,7 @@
 {
 	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 @@
 		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 *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 *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;
 	



More information about the asterisk-commits mailing list