~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_once.c

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
void* my_once_alloc(size_t Size, myf MyFlags)
33
33
{
34
34
  size_t get_size, max_left;
35
 
  uchar* point;
 
35
  unsigned char* point;
36
36
  register USED_MEM *next;
37
37
  register USED_MEM **prev;
38
38
 
56
56
      my_errno=errno;
57
57
      if (MyFlags & (MY_FAE+MY_WME))
58
58
        my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),get_size);
59
 
      return((uchar*) 0);
 
59
      return((unsigned char*) 0);
60
60
    }
61
61
    next->next= 0;
62
62
    next->size= get_size;
63
63
    next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM));
64
64
    *prev=next;
65
65
  }
66
 
  point= (uchar*) ((char*) next+ (next->size-next->left));
 
66
  point= (unsigned char*) ((char*) next+ (next->size-next->left));
67
67
  next->left-= Size;
68
68
 
69
69
  if (MyFlags & MY_ZEROFILL)
75
75
char *my_once_strdup(const char *src,myf myflags)
76
76
{
77
77
  size_t len= strlen(src)+1;
78
 
  uchar *dst= my_once_alloc(len, myflags);
 
78
  unsigned char *dst= my_once_alloc(len, myflags);
79
79
  if (dst)
80
80
    memcpy(dst, src, len);
81
81
  return (char*) dst;
84
84
 
85
85
void *my_once_memdup(const void *src, size_t len, myf myflags)
86
86
{
87
 
  uchar *dst= my_once_alloc(len, myflags);
 
87
  unsigned char *dst= my_once_alloc(len, myflags);
88
88
  if (dst)
89
89
    memcpy(dst, src, len);
90
90
  return dst;
105
105
  for (next=my_once_root_block ; next ; )
106
106
  {
107
107
    old=next; next= next->next ;
108
 
    free((uchar*) old);
 
108
    free((unsigned char*) old);
109
109
  }
110
110
  my_once_root_block=0;
111
111