~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_malloc.c

  • Committer: Monty Taylor
  • Date: 2008-08-04 19:37:18 UTC
  • mto: (261.2.2 codestyle)
  • mto: This revision was merged to the branch mainline in revision 262.
  • Revision ID: monty@inaugust.com-20080804193718-f0rz13uli4429ozb
Changed gettext_noop() to N_()

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
  if (!size)
27
27
    size=1;                                     /* Safety */
28
 
  if ((point = malloc(size)) == NULL)
 
28
  if ((point = (char*)malloc(size)) == NULL)
29
29
  {
30
30
    my_errno=errno;
31
31
    if (my_flags & MY_FAE)
41
41
} /* my_malloc */
42
42
 
43
43
 
 
44
        /* Free memory allocated with my_malloc */
 
45
        /*ARGSUSED*/
 
46
 
 
47
void my_no_flags_free(void* ptr)
 
48
{
 
49
  if (ptr)
 
50
    free(ptr);
 
51
  return;
 
52
} /* my_free */
 
53
 
 
54
 
44
55
        /* malloc and copy */
45
56
 
46
57
void* my_memdup(const void *from, size_t length, myf my_flags)
57
68
  char *ptr;
58
69
  size_t length= strlen(from)+1;
59
70
  if ((ptr= (char*) my_malloc(length, my_flags)))
60
 
    memcpy(ptr, from, length);
 
71
    memcpy((uchar*) ptr, (uchar*) from,(size_t) length);
61
72
  return(ptr);
62
73
}
63
74
 
67
78
  char *ptr;
68
79
  if ((ptr= (char*) my_malloc(length+1,my_flags)) != 0)
69
80
  {
70
 
    memcpy(ptr, from, length);
 
81
    memcpy((uchar*) ptr, (uchar*) from, length);
71
82
    ptr[length]=0;
72
83
  }
73
84
  return((char*) ptr);