~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_alloc.c

  • Committer: Monty Taylor
  • Date: 2008-09-16 00:00:48 UTC
  • mto: This revision was merged to the branch mainline in revision 391.
  • Revision ID: monty@inaugust.com-20080916000048-3rvrv3gv9l0ad3gs
Fixed copyright headers in drizzled/

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        {
117
117
          /* remove block from the list and free it */
118
118
          *prev= mem->next;
119
 
          free(mem);
 
119
          my_free(mem, MYF(0));
120
120
        }
121
121
        else
122
122
          prev= &mem->next;
153
153
  {
154
154
    if (mem_root->error_handler)
155
155
      (*mem_root->error_handler)();
156
 
    return((unsigned char*) 0);                 /* purecov: inspected */
 
156
    return((uchar*) 0);                 /* purecov: inspected */
157
157
  }
158
158
  next->next= mem_root->used;
159
159
  next->size= length;
160
160
  mem_root->used= next;
161
 
  return((unsigned char*) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM))));
 
161
  return((uchar*) (((char*) next)+ALIGN_SIZE(sizeof(USED_MEM))));
162
162
#else
163
163
  size_t get_size, block_size;
164
 
  unsigned char* point;
 
164
  uchar* point;
165
165
  register USED_MEM *next= 0;
166
166
  register USED_MEM **prev;
167
167
  assert(alloc_root_inited(mem_root));
186
186
  {                                             /* Time to alloc new block */
187
187
    block_size= mem_root->block_size * (mem_root->block_num >> 2);
188
188
    get_size= length+ALIGN_SIZE(sizeof(USED_MEM));
189
 
    get_size= cmax(get_size, block_size);
 
189
    get_size= max(get_size, block_size);
190
190
 
191
191
    if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME | ME_FATALERROR))))
192
192
    {
201
201
    *prev=next;
202
202
  }
203
203
 
204
 
  point= (unsigned char*) ((char*) next+ (next->size-next->left));
 
204
  point= (uchar*) ((char*) next+ (next->size-next->left));
205
205
  /*TODO: next part may be unneded due to mem_root->first_block_usage counter*/
206
206
  if ((next->left-= length) < mem_root->min_malloc)
207
207
  {                                             /* Full block */
332
332
  {
333
333
    old=next; next= next->next ;
334
334
    if (old != root->pre_alloc)
335
 
      free(old);
 
335
      my_free(old,MYF(0));
336
336
  }
337
337
  for (next=root->free ; next ;)
338
338
  {
339
339
    old=next; next= next->next;
340
340
    if (old != root->pre_alloc)
341
 
      free(old);
 
341
      my_free(old,MYF(0));
342
342
  }
343
343
  root->used=root->free=0;
344
344
  if (root->pre_alloc)