~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/multi_malloc.cc

  • Committer: Monty Taylor
  • Date: 2009-10-06 19:14:39 UTC
  • mfrom: (1130.2.18 plugin-base-class)
  • mto: This revision was merged to the branch mainline in revision 1184.
  • Revision ID: mordred@inaugust.com-20091006191439-fd1vvlp22654l3k3
Merged latest plugin-base-class.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include "config.h"
 
16
#include "drizzled/global.h"
17
17
 
18
18
#include <stdarg.h>
19
19
#include <string.h>
20
20
#include <stdlib.h>
21
21
 
22
22
#include "drizzled/memory/multi_malloc.h"
23
 
#include "drizzled/definitions.h"
24
23
 
25
24
namespace drizzled
26
25
{
61
60
  }
62
61
  va_end(args);
63
62
 
64
 
#ifdef HAVE_VALGRIND
65
 
  if (!(start= calloc(0, tot_length)))
66
 
    return(0);
67
 
#else
68
63
  if (!(start= malloc(tot_length)))
69
64
    return(0);
70
65
  if (zerofill)
71
66
    memset(start, 0, tot_length);
72
 
#endif
73
67
 
74
68
  va_start(args, zerofill);
75
 
  res= static_cast<char *>(start);
 
69
  res=reinterpret_cast<char *>(start);
76
70
  while ((ptr=va_arg(args, void **)))
77
71
  {
78
72
    *ptr=res;
79
 
    length=va_arg(args,unsigned int);
 
73
    length=va_arg(args,uint);
80
74
    res+= ALIGN_SIZE(length);
81
75
  }
82
76
  va_end(args);