summaryrefslogtreecommitdiff
path: root/src/common/memmgr.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-02-20 16:56:22 +0100
committerHaru <haru@dotalux.com>2016-02-20 16:56:22 +0100
commit5448ffa77feb00f27cc494d87f4e9ce82cc5a137 (patch)
tree0155daaf83b22cfce8d49cfa5a7ff51bf39adcbb /src/common/memmgr.c
parent3eb7a270958f33590c9472fe5d25fcf49f82b324 (diff)
downloadhercules-5448ffa77feb00f27cc494d87f4e9ce82cc5a137.tar.gz
hercules-5448ffa77feb00f27cc494d87f4e9ce82cc5a137.tar.bz2
hercules-5448ffa77feb00f27cc494d87f4e9ce82cc5a137.tar.xz
hercules-5448ffa77feb00f27cc494d87f4e9ce82cc5a137.zip
Fixed some warnings in GCC 5.2
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/memmgr.c')
-rw-r--r--src/common/memmgr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common/memmgr.c b/src/common/memmgr.c
index 0c8eceb3c..6b01eb846 100644
--- a/src/common/memmgr.c
+++ b/src/common/memmgr.c
@@ -97,10 +97,10 @@ struct malloc_interface *iMalloc;
#ifndef USE_MEMMGR
-#ifdef __APPLE__
+#if defined __APPLE__
#include <malloc/malloc.h>
#define BUFFER_SIZE(ptr) malloc_size(ptr)
-#elif __FreeBSD__
+#elif defined __FreeBSD__
#include <malloc_np.h>
#define BUFFER_SIZE(ptr) malloc_usable_size(ptr)
#elif defined __linux__ || defined __linux || defined CYGWIN
@@ -149,7 +149,7 @@ void* aRealloc_(void *p, size_t size, const char *file, int line, const char *fu
void* aReallocz_(void *p, size_t size, const char *file, int line, const char *func)
{
- void *ret;
+ unsigned char *ret = NULL;
// ShowMessage("%s:%d: in func %s: aReallocz %p %ld\n",file,line,func,p,size);
#ifdef USE_MEMMGR
ret = REALLOC(p, size, file, line, func);
@@ -159,11 +159,11 @@ void* aReallocz_(void *p, size_t size, const char *file, int line, const char *f
size_t oldSize = BUFFER_SIZE(p);
ret = REALLOC(p, size, file, line, func);
newSize = BUFFER_SIZE(ret);
- if (ret && newSize > oldSize)
+ if (ret != NULL && newSize > oldSize)
memset(ret + oldSize, 0, newSize - oldSize);
} else {
ret = REALLOC(p, size, file, line, func);
- if (ret)
+ if (ret != NULL)
memset(ret, 0, BUFFER_SIZE(ret));
}
#endif