Commit bec38058 authored by unknown's avatar unknown
Browse files

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.


include/my_sys.h:
  When we define my_free(PTR,FG) to be my_no_flags_free(PTR) we don't make the compiler check
  correctness of FG, which can hurt if another person build with a different definition of my_free;
  so I add FG in the expression.
mysys/my_realloc.c:
  typo found by the change in my_sys.h :)
parent e7ac9b92
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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_with_length(const byte *from, uint length,
				   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         /* nothing */
#define ORIG_CALLER_INFO    /* nothing */
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ gptr my_realloc(gptr oldpoint, uint size, myf my_flags)
  if ((point = (char*)realloc(oldpoint,size)) == NULL)
  {
    if (my_flags & MY_FREE_ON_ERROR)
      my_free(oldpoint,MyFLAGS);
      my_free(oldpoint, my_flags);
    if (my_flags & MY_HOLD_ON_ERROR)
      DBUG_RETURN(oldpoint);
    my_errno=errno;