[asterisk-commits] file: trunk r75586 - /trunk/funcs/func_curl.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 18 09:59:20 CDT 2007


Author: file
Date: Wed Jul 18 09:59:20 2007
New Revision: 75586

URL: http://svn.digium.com/view/asterisk?view=rev&rev=75586
Log:
Clean up func_curl a bit.

Modified:
    trunk/funcs/func_curl.c

Modified: trunk/funcs/func_curl.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_curl.c?view=diff&rev=75586&r1=75585&r2=75586
==============================================================================
--- trunk/funcs/func_curl.c (original)
+++ trunk/funcs/func_curl.c Wed Jul 18 09:59:20 2007
@@ -60,14 +60,12 @@
 	size_t size;
 };
 
+/* There might be a realloc() out there that doesn't like reallocing
+ * NULL pointers, so we take care of it here
+ */
 static void *myrealloc(void *ptr, size_t size)
 {
-	/* There might be a realloc() out there that doesn't like reallocing
-	   NULL pointers, so we take care of it here */
-	if (ptr)
-		return ast_realloc(ptr, size);
-	else
-		return ast_malloc(size);
+	return (ptr ? ast_realloc(ptr, size) : ast_malloc(size));
 }
 
 static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
@@ -75,12 +73,12 @@
 	register int realsize = size * nmemb;
 	struct MemoryStruct *mem = (struct MemoryStruct *)data;
 
-	mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1);
-	if (mem->memory) {
+	if ((mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1))) {
 		memcpy(&(mem->memory[mem->size]), ptr, realsize);
 		mem->size += realsize;
 		mem->memory[mem->size] = 0;
 	}
+
 	return realsize;
 }
 




More information about the asterisk-commits mailing list