Commit b3aa6d71 authored by antirez's avatar antirez
Browse files

use the function deprecated attribute if compiling with GCC to get warnings...

use the function deprecated attribute if compiling with GCC to get warnings for malloc/free usages. We always want to use our zmalloc/zfree versions for memory usage tracking
parent 399f2f40
...@@ -826,7 +826,7 @@ int qsortRedisCommands(const void *r1, const void *r2) { ...@@ -826,7 +826,7 @@ int qsortRedisCommands(const void *r1, const void *r2) {
void sortCommandTable() { void sortCommandTable() {
/* Copy and sort the read-only version of the command table */ /* Copy and sort the read-only version of the command table */
commandTable = (struct redisCommand*)malloc(sizeof(readonlyCommandTable)); commandTable = (struct redisCommand*)zmalloc(sizeof(readonlyCommandTable));
memcpy(commandTable,readonlyCommandTable,sizeof(readonlyCommandTable)); memcpy(commandTable,readonlyCommandTable,sizeof(readonlyCommandTable));
qsort(commandTable, qsort(commandTable,
sizeof(readonlyCommandTable)/sizeof(struct redisCommand), sizeof(readonlyCommandTable)/sizeof(struct redisCommand),
......
...@@ -885,4 +885,12 @@ void publishCommand(redisClient *c); ...@@ -885,4 +885,12 @@ void publishCommand(redisClient *c);
void watchCommand(redisClient *c); void watchCommand(redisClient *c);
void unwatchCommand(redisClient *c); void unwatchCommand(redisClient *c);
#if defined(__GNUC__)
void *malloc(size_t size) __attribute__ ((deprecated));
void *calloc(size_t count, size_t size) __attribute__ ((deprecated));
void free(void *ptr) __attribute__ ((deprecated));
void *malloc(size_t size) __attribute__ ((deprecated));
void *realloc(void *ptr, size_t size) __attribute__ ((deprecated));
#endif
#endif #endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment