aboutsummaryrefslogtreecommitdiffstats
path: root/funcs/func_curl.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-18 14:59:20 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-18 14:59:20 +0000
commit5d2824769362d1a06355bb5cccae10b5eae5612e (patch)
treec67a5d9fa9bc2f30c3e8a4ec3d8383b120573326 /funcs/func_curl.c
parent7a12ef01a3e4bc7db7974006242694bb7d036751 (diff)
Clean up func_curl a bit.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@75586 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_curl.c')
-rw-r--r--funcs/func_curl.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/funcs/func_curl.c b/funcs/func_curl.c
index b32d5f748..a33b8db64 100644
--- a/funcs/func_curl.c
+++ b/funcs/func_curl.c
@@ -60,14 +60,12 @@ struct MemoryStruct {
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 @@ static size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *da
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;
}