~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/filesort.cc

  • Committer: Monty Taylor
  • Date: 2008-10-02 01:31:53 UTC
  • mfrom: (398.1.6 codestyle-new)
  • Revision ID: monty@inaugust.com-20081002013153-b097om921cd3j1pn
MergedĀ fromĀ stdint-includes-fix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
176
176
#ifdef CAN_TRUST_RANGE
177
177
  if (select && select->quick && select->quick->records > 0L)
178
178
  {
179
 
    records=min((ha_rows) (select->quick->records*2+EXTRA_RECORDS*2),
 
179
    records=cmin((ha_rows) (select->quick->records*2+EXTRA_RECORDS*2),
180
180
                table->file->stats.records)+EXTRA_RECORDS;
181
181
    selected_records_file=0;
182
182
  }
198
198
    goto err;
199
199
 
200
200
  memavl= thd->variables.sortbuff_size;
201
 
  min_sort_memory= max((uint)MIN_SORT_MEMORY, param.sort_length*MERGEBUFF2);
 
201
  min_sort_memory= cmax((uint)MIN_SORT_MEMORY, param.sort_length*MERGEBUFF2);
202
202
  while (memavl >= min_sort_memory)
203
203
  {
204
204
    uint32_t old_memavl;
205
205
    uint32_t keys= memavl/(param.rec_length+sizeof(char*));
206
 
    param.keys=(uint) min(records+1, keys);
 
206
    param.keys=(uint) cmin(records+1, keys);
207
207
    if ((table_sort.sort_keys=
208
208
         (uchar **) make_char_array((char **) table_sort.sort_keys,
209
209
                                    param.keys, param.rec_length, MYF(0))))
1039
1039
  register uint count;
1040
1040
  uint length;
1041
1041
 
1042
 
  if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
 
1042
  if ((count=(uint) cmin((ha_rows) buffpek->max_keys,buffpek->count)))
1043
1043
  {
1044
1044
    if (pread(fromfile->file,(uchar*) buffpek->base, (length= rec_length*count),buffpek->file_pos) == 0)
1045
1045
      return((uint) -1);                        /* purecov: inspected */
1300
1300
         != -1 && error != 0);
1301
1301
 
1302
1302
end:
1303
 
  lastbuff->count= min(org_max_rows-max_rows, param->max_rows);
 
1303
  lastbuff->count= cmin(org_max_rows-max_rows, param->max_rows);
1304
1304
  lastbuff->file_pos= to_start_filepos;
1305
1305
err:
1306
1306
  delete_queue(&queue);