Commit a56b0447 authored by iggy@recycle.(none)'s avatar iggy@recycle.(none)

Merge recycle.(none):/src/bug23736/my50-bug23736

into  recycle.(none):/src/bug23736/my51-bug23736
parents 8ecbf6c0 988ce580
......@@ -158,11 +158,7 @@ class Load_log_processor
public:
Load_log_processor() {}
~Load_log_processor()
{
destroy();
delete_dynamic(&file_names);
}
~Load_log_processor() {}
int init()
{
......@@ -185,7 +181,7 @@ class Load_log_processor
{
File_name_record *ptr= (File_name_record *)file_names.buffer;
File_name_record *end= ptr + file_names.elements;
for (; ptr<end; ptr++)
for (; ptr < end; ptr++)
{
if (ptr->fname)
{
......@@ -194,6 +190,8 @@ class Load_log_processor
bzero((char *)ptr, sizeof(File_name_record));
}
}
delete_dynamic(&file_names);
}
/*
......@@ -1577,6 +1575,7 @@ int main(int argc, char** argv)
cleanup();
free_defaults(defaults_argv);
my_free_open_file_info();
load_processor.destroy();
/* We cannot free DBUG, it is used in global destructors after exit(). */
my_end((info_flag ? MY_CHECK_ERROR : 0) | MY_DONT_FREE_DBUG);
......
......@@ -312,8 +312,17 @@ struct st_my_file_info
extern struct st_my_file_info *my_file_info;
typedef struct st_dynamic_array
{
char *buffer;
uint elements,max_element;
uint alloc_increment;
uint size_of_element;
} DYNAMIC_ARRAY;
typedef struct st_my_tmpdir
{
DYNAMIC_ARRAY full_list;
char **list;
uint cur, max;
#ifdef THREAD
......@@ -321,14 +330,6 @@ typedef struct st_my_tmpdir
#endif
} MY_TMPDIR;
typedef struct st_dynamic_array
{
char *buffer;
uint elements,max_element;
uint alloc_increment;
uint size_of_element;
} DYNAMIC_ARRAY;
typedef struct st_dynamic_string
{
char *str;
......
......@@ -15,10 +15,6 @@
/* Handling of arrays that can grow dynamicly. */
#if defined(WIN32) || defined(__WIN__)
#undef SAFEMALLOC /* Problems with threads */
#endif
#include "mysys_priv.h"
#include "m_string.h"
......
......@@ -26,12 +26,11 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
{
char *end, *copy;
char buff[FN_REFLEN];
DYNAMIC_ARRAY t_arr;
DBUG_ENTER("init_tmpdir");
DBUG_PRINT("enter", ("pathlist: %s", pathlist ? pathlist : "NULL"));
pthread_mutex_init(&tmpdir->mutex, MY_MUTEX_INIT_FAST);
if (my_init_dynamic_array(&t_arr, sizeof(char*), 1, 5))
if (my_init_dynamic_array(&tmpdir->full_list, sizeof(char*), 1, 5))
goto err;
if (!pathlist || !pathlist[0])
{
......@@ -53,14 +52,14 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
strmake(buff, pathlist, (uint) (end-pathlist));
length= cleanup_dirname(buff, buff);
if (!(copy= my_strndup(buff, length, MYF(MY_WME))) ||
insert_dynamic(&t_arr, (gptr) &copy))
insert_dynamic(&tmpdir->full_list, (gptr) &copy))
DBUG_RETURN(TRUE);
pathlist=end+1;
}
while (*end);
freeze_size(&t_arr);
tmpdir->list=(char **)t_arr.buffer;
tmpdir->max=t_arr.elements-1;
freeze_size(&tmpdir->full_list);
tmpdir->list=(char **)tmpdir->full_list.buffer;
tmpdir->max=tmpdir->full_list.elements-1;
tmpdir->cur=0;
DBUG_RETURN(FALSE);
......@@ -88,7 +87,7 @@ void free_tmpdir(MY_TMPDIR *tmpdir)
uint i;
for (i=0; i<=tmpdir->max; i++)
my_free(tmpdir->list[i], MYF(0));
my_free((gptr)tmpdir->list, MYF(0));
delete_dynamic(&tmpdir->full_list);
pthread_mutex_destroy(&tmpdir->mutex);
}
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