Skip to content

Commit 5d46eee

Browse files
kevgssvoj
authored andcommitted
Simplified away READ_RECORD::cache_records
1 parent 3950a98 commit 5d46eee

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

sql/records.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ static int rr_unpack_from_buffer(READ_RECORD *info)
584584

585585
static int init_rr_cache(THD *thd, READ_RECORD *info)
586586
{
587-
uint rec_cache_size;
587+
uint rec_cache_size, cache_records;
588588
DBUG_ENTER("init_rr_cache");
589589

590590
info->struct_length= 3+MAX_REFLENGTH;
@@ -593,22 +593,22 @@ static int init_rr_cache(THD *thd, READ_RECORD *info)
593593
info->reclength= ALIGN_SIZE(info->struct_length);
594594

595595
info->error_offset= info->table->s->reclength;
596-
info->cache_records= (thd->variables.read_rnd_buff_size /
597-
(info->reclength+info->struct_length));
598-
rec_cache_size= info->cache_records*info->reclength;
599-
info->rec_cache_size= info->cache_records*info->ref_length;
596+
cache_records= thd->variables.read_rnd_buff_size /
597+
(info->reclength + info->struct_length);
598+
rec_cache_size= cache_records * info->reclength;
599+
info->rec_cache_size= cache_records * info->ref_length;
600600

601601
// We have to allocate one more byte to use uint3korr (see comments for it)
602-
if (info->cache_records <= 2 ||
603-
!(info->cache=(uchar*) my_malloc_lock(rec_cache_size+info->cache_records*
604-
info->struct_length+1,
605-
MYF(MY_THREAD_SPECIFIC))))
602+
if (cache_records <= 2 ||
603+
!(info->cache= (uchar*) my_malloc_lock(rec_cache_size + cache_records *
604+
info->struct_length + 1,
605+
MYF(MY_THREAD_SPECIFIC))))
606606
DBUG_RETURN(1);
607607
#ifdef HAVE_valgrind
608608
// Avoid warnings in qsort
609-
bzero(info->cache,rec_cache_size+info->cache_records* info->struct_length+1);
609+
bzero(info->cache, rec_cache_size + cache_records * info->struct_length + 1);
610610
#endif
611-
DBUG_PRINT("info",("Allocated buffert for %d records",info->cache_records));
611+
DBUG_PRINT("info", ("Allocated buffer for %d records", cache_records));
612612
info->read_positions=info->cache+rec_cache_size;
613613
info->cache_pos=info->cache_end=info->cache;
614614
DBUG_RETURN(0);

sql/records.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ struct READ_RECORD
5656
Read_func read_record_func;
5757
THD *thd;
5858
SQL_SELECT *select;
59-
uint cache_records;
6059
uint ref_length,struct_length,reclength,rec_cache_size,error_offset;
6160
uchar *ref_pos;/* pointer to form->refpos */
6261
uchar *record;

0 commit comments

Comments
 (0)