Commit 7ffc2004 authored by unknown's avatar unknown

Enchanced my_once..() functions.

Cleaned up charset.c
Removed non fatal memory leak in charset.c


include/my_sys.h:
  Enchanced my_once..() functions.
mysys/charset.c:
  Moved my_once_strdup() to my_once.cc
  Added usage of my_once_memdup()
  A lot of indentation changes.
mysys/my_once.c:
  Enchanced my_once..() functions.
parent c49ef18b
......@@ -505,6 +505,8 @@ extern int my_setwd(const char *dir,myf MyFlags);
extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags);
extern gptr my_once_alloc(uint Size,myf MyFlags);
extern void my_once_free(void);
extern char *my_once_strdup(const char *src,myf myflags);
extern char *my_once_memdup(const char *src, uint len, myf myflags);
extern my_string my_tempnam(const char *dir,const char *pfx,myf MyFlags);
extern File my_open(const char *FileName,int Flags,myf MyFlags);
extern File my_register_filename(File fd, const char *FileName,
......
This diff is collapsed.
......@@ -78,6 +78,25 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags)
} /* my_once_alloc */
char *my_once_strdup(const char *src,myf myflags)
{
uint len=strlen(src)+1;
char *dst=my_once_alloc(len, myflags);
if (dst)
memcpy(dst, src, len);
return dst;
}
char *my_once_memdup(const char *src, uint len, myf myflags)
{
char *dst=my_once_alloc(len, myflags);
if (dst)
memcpy(dst, src, len);
return dst;
}
/*
Deallocate everything used by my_once_alloc
......
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