Commit 621e28cb authored by guilhem@mysql.com's avatar guilhem@mysql.com

Building with compile-pentium-valgrind-max (without safemalloc) defines my_free() without flags,

so a typo on flags will go unnoticed; I put flags in this my_free() definition (as a no-op which
will still make the compiler check correctness of the flags). Applied: this caught a typo in my_realloc.c. Kindly approved by Konstantin and Mats.
parent fb3506f3
...@@ -158,7 +158,8 @@ extern gptr my_memdup(const byte *from,uint length,myf MyFlags); ...@@ -158,7 +158,8 @@ extern gptr my_memdup(const byte *from,uint length,myf MyFlags);
extern char *my_strdup(const char *from,myf MyFlags); extern char *my_strdup(const char *from,myf MyFlags);
extern char *my_strdup_with_length(const byte *from, uint length, extern char *my_strdup_with_length(const byte *from, uint length,
myf MyFlags); myf MyFlags);
#define my_free(PTR,FG) my_no_flags_free(PTR) /* we do use FG (as a no-op) in below so that a typo on FG is caught */
#define my_free(PTR,FG) ((void)FG,my_no_flags_free(PTR))
#define CALLER_INFO_PROTO /* nothing */ #define CALLER_INFO_PROTO /* nothing */
#define CALLER_INFO /* nothing */ #define CALLER_INFO /* nothing */
#define ORIG_CALLER_INFO /* nothing */ #define ORIG_CALLER_INFO /* nothing */
......
...@@ -52,7 +52,7 @@ gptr my_realloc(gptr oldpoint, uint size, myf my_flags) ...@@ -52,7 +52,7 @@ gptr my_realloc(gptr oldpoint, uint size, myf my_flags)
if ((point = (char*)realloc(oldpoint,size)) == NULL) if ((point = (char*)realloc(oldpoint,size)) == NULL)
{ {
if (my_flags & MY_FREE_ON_ERROR) if (my_flags & MY_FREE_ON_ERROR)
my_free(oldpoint,MyFLAGS); my_free(oldpoint, my_flags);
if (my_flags & MY_HOLD_ON_ERROR) if (my_flags & MY_HOLD_ON_ERROR)
DBUG_RETURN(oldpoint); DBUG_RETURN(oldpoint);
my_errno=errno; my_errno=errno;
......
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