Commit 59311f3e authored by Alexander Barkov's avatar Alexander Barkov

Make PCRE use my_malloc() and my_free().

This patch also makes libstrings use my_malloc() and my_free()
in embedded server. Previously, embeddes server used malloc()
and free() in libstrings.
parent ccb1344f
......@@ -3278,7 +3278,6 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
}
#ifndef EMBEDDED_LIBRARY
extern "C" void *my_str_malloc_mysqld(size_t size);
extern "C" void my_str_free_mysqld(void *ptr);
......@@ -3292,7 +3291,24 @@ void my_str_free_mysqld(void *ptr)
{
my_free(ptr);
}
#endif /* EMBEDDED_LIBRARY */
/*
Initialize my_str_malloc() and my_str_free()
*/
static void init_libstrings()
{
my_str_malloc= &my_str_malloc_mysqld;
my_str_free= &my_str_free_mysqld;
}
static void init_pcre()
{
pcre_malloc= pcre_stack_malloc= my_str_malloc_mysqld;
pcre_free= pcre_stack_free= my_str_free_mysqld;
}
#ifdef __WIN__
......@@ -3600,6 +3616,7 @@ static int init_common_variables()
set_current_thd(0);
set_malloc_size_cb(my_malloc_size_cb_func);
init_libstrings();
tzset(); // Set tzname
sf_leaking_memory= 0; // no memory leaks from now on
......@@ -3902,6 +3919,7 @@ static int init_common_variables()
if (item_create_init())
return 1;
item_init();
init_pcre();
#ifndef EMBEDDED_LIBRARY
my_string_stack_guard= check_enough_stack_size;
#endif
......@@ -5058,12 +5076,6 @@ int mysqld_main(int argc, char **argv)
}
#endif
/*
Initialize my_str_malloc() and my_str_free()
*/
my_str_malloc= &my_str_malloc_mysqld;
my_str_free= &my_str_free_mysqld;
/*
init signals & alarm
After this we can't quit by a simple unireg_abort
......
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