From 066e8900d63e85500b7f6a48b2cada93924aa600 Mon Sep 17 00:00:00 2001
From: unknown <marko@hundin.mysql.fi>
Date: Thu, 10 Mar 2005 15:16:16 +0200
Subject: [PATCH] InnoDB: Introduce the symbols REC_OFFS_NORMAL_SIZE and
 REC_OFFS_SMALL_SIZE for the initial allocation sizes of arrays passed to
 rec_get_offsets().

innobase/btr/btr0btr.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/btr/btr0cur.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/btr/btr0sea.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/include/rem0rec.h:
  Define REC_OFFS_NORMAL_SIZE and REC_OFFS_SMALL_SIZE.
innobase/lock/lock0lock.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/page/page0cur.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/page/page0page.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/rem/rem0rec.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/row/row0ins.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/row/row0mysql.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/row/row0purge.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/row/row0row.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/row/row0sel.c:
  s/100/REC_OFFS_NORMAL_SIZE/
  s/10/REC_OFFS_SMALL_SIZE/
innobase/row/row0undo.c:
  s/100/REC_OFFS_NORMAL_SIZE/
innobase/row/row0upd.c:
  s/100/REC_OFFS_NORMAL_SIZE/
  s/10/REC_OFFS_SMALL_SIZE/
innobase/trx/trx0rec.c:
  s/100/REC_OFFS_NORMAL_SIZE/
---
 innobase/btr/btr0btr.c     |  8 ++++----
 innobase/btr/btr0cur.c     | 20 ++++++++++----------
 innobase/btr/btr0sea.c     | 12 ++++++------
 innobase/include/rem0rec.h |  5 +++++
 innobase/lock/lock0lock.c  | 10 +++++-----
 innobase/page/page0cur.c   | 14 +++++++-------
 innobase/page/page0page.c  | 12 ++++++------
 innobase/rem/rem0rec.c     |  6 +++---
 innobase/row/row0ins.c     |  8 ++++----
 innobase/row/row0mysql.c   |  2 +-
 innobase/row/row0purge.c   |  2 +-
 innobase/row/row0row.c     |  8 ++++----
 innobase/row/row0sel.c     | 12 ++++++------
 innobase/row/row0undo.c    |  2 +-
 innobase/row/row0upd.c     | 14 +++++++-------
 innobase/trx/trx0rec.c     |  2 +-
 16 files changed, 71 insertions(+), 66 deletions(-)

diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c
index 232d7f0f53b..1744fc36f4d 100644
--- a/innobase/btr/btr0btr.c
+++ b/innobase/btr/btr0btr.c
@@ -567,7 +567,7 @@ btr_page_get_father_for_rec(
 	btr_cur_t	cursor;
 	rec_t*		node_ptr;
 	dict_index_t*	index;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets	= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -2099,7 +2099,7 @@ btr_compress(
 		btr_node_ptr_delete(tree, page, mtr);
 	} else {
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 		/* Replace the address of the old child node (= page) with the 
 		address of the merge page to the right */
@@ -2389,7 +2389,7 @@ btr_print_tree(
 	mtr_t		mtr;
 	page_t*		root;
 	mem_heap_t*	heap	= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets	= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -2491,7 +2491,7 @@ btr_index_rec_validate(
 	ulint		i;
 	page_t*		page;
 	mem_heap_t*	heap	= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets	= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
diff --git a/innobase/btr/btr0cur.c b/innobase/btr/btr0cur.c
index 6279ac79d3a..e093c911f22 100644
--- a/innobase/btr/btr0cur.c
+++ b/innobase/btr/btr0cur.c
@@ -275,7 +275,7 @@ btr_cur_search_to_nth_level(
 	btr_search_t*	info;
 #endif
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 	/* Currently, PAGE_CUR_LE is the only search mode used for searches
@@ -579,7 +579,7 @@ btr_cur_open_at_index_side(
 	ulint		estimate;
 	ulint           savepoint;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -705,7 +705,7 @@ btr_cur_open_at_rnd_pos(
 	ulint		height;
 	rec_t*		node_ptr;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1255,7 +1255,7 @@ btr_cur_upd_lock_and_undo(
 
 	if (!(flags & BTR_NO_LOCKING_FLAG)) {
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
 		err = lock_clust_rec_modify_check_and_lock(flags, rec, index,
@@ -1431,7 +1431,7 @@ btr_cur_update_in_place(
 	trx_t*		trx;
 	ibool		was_delete_marked;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -2071,7 +2071,7 @@ btr_cur_parse_del_mark_set_clust_rec(
 	
 		if (!(flags & BTR_KEEP_SYS_FLAG)) {
 			mem_heap_t*	heap		= NULL;
-			ulint		offsets_[100];
+			ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 			*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
 			row_upd_rec_sys_fields_in_recovery(rec,
@@ -2117,7 +2117,7 @@ btr_cur_del_mark_set_clust_rec(
 	rec_t*		rec;
 	trx_t*		trx;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -2408,7 +2408,7 @@ btr_cur_optimistic_delete(
 	ulint		max_ins_size;
 	rec_t*		rec;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	ibool		no_compress_needed;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
@@ -2813,8 +2813,8 @@ btr_estimate_number_of_different_key_vals(
 	ulint		add_on;
 	mtr_t		mtr;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets1_[100];
-	ulint		offsets2_[100];
+	ulint		offsets1_[REC_OFFS_NORMAL_SIZE];
+	ulint		offsets2_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets1	= offsets1_;
 	ulint*		offsets2	= offsets2_;
 	*offsets1_ = (sizeof offsets1_) / sizeof *offsets1_;
diff --git a/innobase/btr/btr0sea.c b/innobase/btr/btr0sea.c
index 5f95937a2cb..97fdce2df75 100644
--- a/innobase/btr/btr0sea.c
+++ b/innobase/btr/btr0sea.c
@@ -420,7 +420,7 @@ btr_search_update_hash_ref(
 	    && (block->curr_n_bytes == info->n_bytes)
 	    && (block->curr_side == info->side)) {
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
 	    	rec = btr_cur_get_rec(cursor);
@@ -553,7 +553,7 @@ btr_search_check_guess(
 	ulint		bytes;
 	int		cmp;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	ibool		success		= FALSE;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
@@ -1100,7 +1100,7 @@ btr_search_build_page_hash_index(
 	rec_t**		recs;
 	ulint		i;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1344,7 +1344,7 @@ btr_search_update_hash_on_delete(
 	ulint		fold;
 	dulint		tree_id;
 	ibool		found;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	mem_heap_t*	heap		= NULL;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1456,7 +1456,7 @@ btr_search_update_hash_on_insert(
 	ulint		side;
 	ibool		locked		= FALSE;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1596,7 +1596,7 @@ btr_search_validate(void)
 	ibool		ok		= TRUE;
 	ulint		i;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 	
diff --git a/innobase/include/rem0rec.h b/innobase/include/rem0rec.h
index 6721fa85f16..ad7397fa140 100644
--- a/innobase/include/rem0rec.h
+++ b/innobase/include/rem0rec.h
@@ -36,6 +36,11 @@ in addition to the data and the offsets */
 #define REC_STATUS_INFIMUM	2
 #define REC_STATUS_SUPREMUM	3
 
+/* Number of elements that should be initially allocated for the
+offsets[] array, first passed to rec_get_offsets() */
+#define REC_OFFS_NORMAL_SIZE	1/*00*/
+#define REC_OFFS_SMALL_SIZE	1/*0*/
+
 /**********************************************************
 The following function is used to get the offset of the
 next chained record on the same page. */
diff --git a/innobase/lock/lock0lock.c b/innobase/lock/lock0lock.c
index 66a746111e8..512f487b3f5 100644
--- a/innobase/lock/lock0lock.c
+++ b/innobase/lock/lock0lock.c
@@ -4094,7 +4094,7 @@ lock_rec_print(
 	ulint		i;
 	mtr_t		mtr;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -4593,7 +4593,7 @@ lock_rec_validate_page(
 	ulint	i;
 	mtr_t	mtr;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -4843,7 +4843,7 @@ lock_rec_insert_check_and_lock(
 #ifdef UNIV_DEBUG
 	{
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		const ulint*	offsets;
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -4992,7 +4992,7 @@ lock_sec_rec_modify_check_and_lock(
 #ifdef UNIV_DEBUG
 	{
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		const ulint*	offsets;
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -5166,7 +5166,7 @@ lock_clust_rec_read_check_and_lock_alt(
 	que_thr_t*	thr)	/* in: query thread */
 {
 	mem_heap_t*	tmp_heap	= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	ulint		ret;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
diff --git a/innobase/page/page0cur.c b/innobase/page/page0cur.c
index 1b0df59d57f..7738f5a34f0 100644
--- a/innobase/page/page0cur.c
+++ b/innobase/page/page0cur.c
@@ -59,7 +59,7 @@ page_cur_try_search_shortcut(
 #endif
 	ibool		success		= FALSE;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -231,7 +231,7 @@ page_cur_search_with_match(
 	ulint	dbg_matched_bytes;
 #endif
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -520,8 +520,8 @@ page_cur_insert_rec_write_log(
 
 	{
 		mem_heap_t*	heap		= NULL;
-		ulint		cur_offs_[100];
-		ulint		ins_offs_[100];
+		ulint		cur_offs_[REC_OFFS_NORMAL_SIZE];
+		ulint		ins_offs_[REC_OFFS_NORMAL_SIZE];
 
 		ulint*		cur_offs;
 		ulint*		ins_offs;
@@ -677,7 +677,7 @@ page_cur_parse_insert_rec(
 	ulint	info_and_status_bits = 0; /* remove warning */
 	page_cur_t cursor;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1086,7 +1086,7 @@ page_copy_rec_list_end_to_created_page(
 	ulint	log_data_len;
 	ibool		comp		= page_is_comp(page);
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 	
@@ -1276,7 +1276,7 @@ page_cur_parse_delete_rec(
 
 	if (page) {
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		rec_t*		rec		= page + offset;
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
diff --git a/innobase/page/page0page.c b/innobase/page/page0page.c
index eb8a11f113b..f3217e91f58 100644
--- a/innobase/page/page0page.c
+++ b/innobase/page/page0page.c
@@ -232,7 +232,7 @@ page_mem_alloc(
 
 	if (rec) {
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		ulint*		offsets		= offsets_;
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -467,7 +467,7 @@ page_copy_rec_list_end_no_locks(
 	page_cur_t	cur2;
 	rec_t*		sup;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -568,7 +568,7 @@ page_copy_rec_list_start(
 	page_cur_t	cur2;
 	rec_t*		old_end;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -750,7 +750,7 @@ page_delete_rec_list_end(
 
 	if ((size == ULINT_UNDEFINED) || (n_recs == ULINT_UNDEFINED)) {
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		ulint*		offsets		= offsets_;
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 		/* Calculate the sum of sizes and the number of records */
@@ -835,7 +835,7 @@ page_delete_rec_list_start(
 {
 	page_cur_t	cur1;
 	ulint		log_mode;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	mem_heap_t*	heap		= NULL;
 	byte		type;
@@ -1331,7 +1331,7 @@ page_print_list(
 	ulint		count;
 	ulint		n_recs;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
diff --git a/innobase/rem/rem0rec.c b/innobase/rem/rem0rec.c
index 94b2c692897..542c746209b 100644
--- a/innobase/rem/rem0rec.c
+++ b/innobase/rem/rem0rec.c
@@ -958,7 +958,7 @@ rec_convert_dtuple_to_rec(
 #ifdef UNIV_DEBUG
 	{
 		mem_heap_t*	heap	= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		const ulint*	offsets;
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -991,7 +991,7 @@ rec_copy_prefix_to_dtuple(
 	ulint		len;
 	byte*		buf = NULL;
 	ulint		i;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets	= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1407,7 +1407,7 @@ rec_print(
 		return;
 	} else {
 		mem_heap_t*	heap	= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
 		rec_print_new(file, rec, rec_get_offsets(rec, index, offsets_,
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index 99a74501ade..fdbbe993ff0 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -1134,7 +1134,7 @@ row_ins_check_foreign_constraint(
 	mtr_t		mtr;
 	trx_t*		trx		= thr_get_trx(thr);
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1559,7 +1559,7 @@ row_ins_scan_sec_index_for_duplicate(
 	mtr_t		mtr;
 	trx_t*		trx;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1697,7 +1697,7 @@ row_ins_duplicate_error_in_clust(
 	ulint	n_unique;
 	trx_t*	trx		= thr_get_trx(thr);
 	mem_heap_t*heap		= NULL;
-	ulint	offsets_[100];
+	ulint	offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*	offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1899,7 +1899,7 @@ row_ins_index_entry_low(
 	big_rec_t*	big_rec			= NULL;
 	mtr_t		mtr;
 	mem_heap_t*	heap			= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets			= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
diff --git a/innobase/row/row0mysql.c b/innobase/row/row0mysql.c
index fd8c2b060ef..5009f017053 100644
--- a/innobase/row/row0mysql.c
+++ b/innobase/row/row0mysql.c
@@ -3673,7 +3673,7 @@ row_scan_and_check_index(
 	ibool		contains_null;
 	ulint		i;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
diff --git a/innobase/row/row0purge.c b/innobase/row/row0purge.c
index 659a13b42a9..5893e016011 100644
--- a/innobase/row/row0purge.c
+++ b/innobase/row/row0purge.c
@@ -101,7 +101,7 @@ row_purge_remove_clust_if_poss_low(
 	mtr_t		mtr;
 	rec_t*		rec;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
 	index = dict_table_get_first_index(node->table);
diff --git a/innobase/row/row0row.c b/innobase/row/row0row.c
index 4f080c22af3..a6d3f1d5ab0 100644
--- a/innobase/row/row0row.c
+++ b/innobase/row/row0row.c
@@ -203,7 +203,7 @@ row_build(
 	byte*		buf; 
 	ulint		i;
 	mem_heap_t*	tmp_heap	= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
 	ut_ad(index && rec && heap);
@@ -297,7 +297,7 @@ row_rec_to_index_entry(
 	ulint		rec_len;
 	byte*		buf;
 	mem_heap_t*	tmp_heap	= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -379,7 +379,7 @@ row_build_row_ref(
 	ulint		clust_col_prefix_len;
 	ulint		i;
 	mem_heap_t*	tmp_heap	= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -473,7 +473,7 @@ row_build_row_ref_in_tuple(
 	ulint		clust_col_prefix_len;
 	ulint		i;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
diff --git a/innobase/row/row0sel.c b/innobase/row/row0sel.c
index 16e2dc69e0b..8915d795451 100644
--- a/innobase/row/row0sel.c
+++ b/innobase/row/row0sel.c
@@ -79,8 +79,8 @@ row_sel_sec_rec_is_for_clust_rec(
         ulint           i;
 	dtype_t*	cur_type;
 	mem_heap_t*	heap		= NULL;
-	ulint		clust_offsets_[100];
-	ulint		sec_offsets_[10];
+	ulint		clust_offsets_[REC_OFFS_NORMAL_SIZE];
+	ulint		sec_offsets_[REC_OFFS_SMALL_SIZE];
 	ulint*		clust_offs	= clust_offsets_;
 	ulint*		sec_offs	= sec_offsets_;
 	ibool		is_equal	= TRUE;
@@ -626,7 +626,7 @@ row_sel_get_clust_rec(
 	rec_t*		old_vers;
 	ulint		err;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -992,7 +992,7 @@ row_sel_try_search_shortcut(
 	dict_index_t*	index;
 	rec_t*		rec;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	ulint		ret;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
@@ -1118,7 +1118,7 @@ row_sel(
 	ulint		found_flag;
 	ulint		err;
 	mem_heap_t*	heap				= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets				= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -3039,7 +3039,7 @@ row_search_for_mysql(
 	ulint		next_offs;
 	mtr_t		mtr;
 	mem_heap_t*	heap				= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets				= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
diff --git a/innobase/row/row0undo.c b/innobase/row/row0undo.c
index 895303e361c..abe73cbe705 100644
--- a/innobase/row/row0undo.c
+++ b/innobase/row/row0undo.c
@@ -152,7 +152,7 @@ row_undo_search_clust_to_pcur(
 	ibool		ret;
 	rec_t*		rec;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
diff --git a/innobase/row/row0upd.c b/innobase/row/row0upd.c
index d04e3c3aef1..3305724a89b 100644
--- a/innobase/row/row0upd.c
+++ b/innobase/row/row0upd.c
@@ -706,7 +706,7 @@ row_upd_build_sec_rec_difference_binary(
 	upd_t*		update;
 	ulint		n_diff;
 	ulint		i;
-	ulint		offsets_[10];
+	ulint		offsets_[REC_OFFS_SMALL_SIZE];
 	const ulint*	offsets;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -784,7 +784,7 @@ row_upd_build_difference_binary(
 	ulint		trx_id_pos;
 	ibool		extern_bit;
 	ulint		i;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	const ulint*	offsets;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1195,7 +1195,7 @@ row_upd_store_row(
 	upd_t*		update;
 	rec_t*		rec;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	const ulint*	offsets;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1396,7 +1396,7 @@ row_upd_clust_rec_by_insert(
 	btr_cur	= btr_pcur_get_btr_cur(pcur);
 	
 	if (node->state != UPD_NODE_INSERT_CLUSTERED) {
-		ulint	offsets_[100];
+		ulint	offsets_[REC_OFFS_NORMAL_SIZE];
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
 		err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
@@ -1537,7 +1537,7 @@ row_upd_clust_rec(
 
 	if (err == DB_SUCCESS && big_rec) {
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[100];
+		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 		rec_t*		rec;
 		*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1637,7 +1637,7 @@ row_upd_clust_step(
 	mtr_t		mtr_buf;
 	rec_t*		rec;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	const ulint*	offsets;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
@@ -1995,7 +1995,7 @@ row_upd_in_place_in_select(
 	btr_cur_t*	btr_cur;
 	ulint		err;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;
 
 	ut_ad(sel_node->select_will_do_update);
diff --git a/innobase/trx/trx0rec.c b/innobase/trx/trx0rec.c
index 7b62137ba09..fcb7582ce73 100644
--- a/innobase/trx/trx0rec.c
+++ b/innobase/trx/trx0rec.c
@@ -1016,7 +1016,7 @@ trx_undo_report_row_operation(
 	trx_rseg_t*	rseg;
 	mtr_t		mtr;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[100];
+	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint*		offsets		= offsets_;
 	*offsets_ = (sizeof offsets_) / sizeof *offsets_;