]> git.saurik.com Git - redis.git/commitdiff
use the function deprecated attribute if compiling with GCC to get warnings for mallo...
authorantirez <antirez@gmail.com>
Tue, 27 Jul 2010 07:36:42 +0000 (09:36 +0200)
committerantirez <antirez@gmail.com>
Tue, 27 Jul 2010 07:36:42 +0000 (09:36 +0200)
src/redis.c
src/redis.h

index 9978eab5637818886f2594d5e8a70d09d4d416c0..f6040dfe7dcfbd3d857d45fc8a8c7e64bbce76dc 100644 (file)
@@ -826,7 +826,7 @@ int qsortRedisCommands(const void *r1, const void *r2) {
 
 void sortCommandTable() {
     /* Copy and sort the read-only version of the command table */
 
 void sortCommandTable() {
     /* 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));
     qsort(commandTable,
         sizeof(readonlyCommandTable)/sizeof(struct redisCommand),
     memcpy(commandTable,readonlyCommandTable,sizeof(readonlyCommandTable));
     qsort(commandTable,
         sizeof(readonlyCommandTable)/sizeof(struct redisCommand),
index d5fabc2d226a404173362091b80bdc5eeadbe1ee..7aca2abcc0cf7bc82d7c953e1c6134735ac1953a 100644 (file)
@@ -885,4 +885,12 @@ void publishCommand(redisClient *c);
 void watchCommand(redisClient *c);
 void unwatchCommand(redisClient *c);
 
 void watchCommand(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