summaryrefslogtreecommitdiff
path: root/sql/records.cc
diff options
context:
space:
mode:
authorEugene Kosov <claprix@yandex.ru>2018-05-29 23:25:50 +0300
committerSergey Vojtovich <svoj@mariadb.org>2019-05-28 14:54:38 +0400
commitfcb68ffe3dfb1c841852bd62a9aac9708888f4e9 (patch)
tree111b271dab643ffc788a3d51a5acafd41c13cf8d /sql/records.cc
parent5d46eeefad33f084be3a52dfaf3169c0b5e3f608 (diff)
downloadmariadb-git-fcb68ffe3dfb1c841852bd62a9aac9708888f4e9.tar.gz
Simplified away READ_RECORD::struct_length
Diffstat (limited to 'sql/records.cc')
-rw-r--r--sql/records.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/records.cc b/sql/records.cc
index 662931f3da7..c2db29c4912 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -582,31 +582,32 @@ static int rr_unpack_from_buffer(READ_RECORD *info)
}
/* cacheing of records from a database */
+static const uint STRUCT_LENGTH= 3 + MAX_REFLENGTH;
+
static int init_rr_cache(THD *thd, READ_RECORD *info)
{
uint rec_cache_size, cache_records;
DBUG_ENTER("init_rr_cache");
- info->struct_length= 3+MAX_REFLENGTH;
info->reclength= ALIGN_SIZE(info->table->s->reclength+1);
- if (info->reclength < info->struct_length)
- info->reclength= ALIGN_SIZE(info->struct_length);
+ if (info->reclength < STRUCT_LENGTH)
+ info->reclength= ALIGN_SIZE(STRUCT_LENGTH);
info->error_offset= info->table->s->reclength;
cache_records= thd->variables.read_rnd_buff_size /
- (info->reclength + info->struct_length);
+ (info->reclength + STRUCT_LENGTH);
rec_cache_size= cache_records * info->reclength;
info->rec_cache_size= cache_records * info->ref_length;
// We have to allocate one more byte to use uint3korr (see comments for it)
if (cache_records <= 2 ||
!(info->cache= (uchar*) my_malloc_lock(rec_cache_size + cache_records *
- info->struct_length + 1,
+ STRUCT_LENGTH + 1,
MYF(MY_THREAD_SPECIFIC))))
DBUG_RETURN(1);
#ifdef HAVE_valgrind
// Avoid warnings in qsort
- bzero(info->cache, rec_cache_size + cache_records * info->struct_length + 1);
+ bzero(info->cache, rec_cache_size + cache_records * STRUCT_LENGTH + 1);
#endif
DBUG_PRINT("info", ("Allocated buffer for %d records", cache_records));
info->read_positions=info->cache+rec_cache_size;
@@ -663,8 +664,7 @@ static int rr_from_cache(READ_RECORD *info)
int3store(ref_position,(long) i);
ref_position+=3;
}
- my_qsort(info->read_positions, length, info->struct_length,
- (qsort_cmp) rr_cmp);
+ my_qsort(info->read_positions, length, STRUCT_LENGTH, (qsort_cmp) rr_cmp);
position=info->read_positions;
for (i=0 ; i < length ; i++)