~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/filesort.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-03-14 03:03:13 UTC
  • mto: (934.3.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 938.
  • Revision ID: osullivan.padraig@gmail.com-20090314030313-q37vwluiqphh1whc
Remove the function reuse_freed_buff(). It is not used anymore based on the
refactoring that I have performed. Its kinda cool to be able to remove
unused functions like that!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1057
1057
} /* read_to_buffer */
1058
1058
 
1059
1059
 
1060
 
/**
1061
 
  Put all room used by freed buffer to use in adjacent buffer.
1062
 
 
1063
 
  Note, that we can't simply distribute memory evenly between all buffers,
1064
 
  because new areas must not overlap with old ones.
1065
 
 
1066
 
  @param[in] queue      list of non-empty buffers, without freed buffer
1067
 
  @param[in] reuse      empty buffer
1068
 
  @param[in] key_length key length
1069
 
*/
1070
 
 
1071
 
void reuse_freed_buff(QUEUE *queue, BUFFPEK *reuse, uint32_t key_length)
1072
 
{
1073
 
  unsigned char *reuse_end= reuse->base + reuse->max_keys * key_length;
1074
 
  for (uint32_t i= 0; i < queue->elements; ++i)
1075
 
  {
1076
 
    BUFFPEK *bp= (BUFFPEK *) queue_element(queue, i);
1077
 
    if (bp->base + bp->max_keys * key_length == reuse->base)
1078
 
    {
1079
 
      bp->max_keys+= reuse->max_keys;
1080
 
      return;
1081
 
    }
1082
 
    else if (bp->base == reuse_end)
1083
 
    {
1084
 
      bp->base= reuse->base;
1085
 
      bp->max_keys+= reuse->max_keys;
1086
 
      return;
1087
 
    }
1088
 
  }
1089
 
  assert(0);
1090
 
}
1091
 
 
1092
1060
class compare_functor
1093
1061
{
1094
1062
  qsort2_cmp key_compare;