From f68d3656dcfe9e64503f4773a62df15e42a065bf Mon Sep 17 00:00:00 2001 From: marko Date: Mon, 13 Aug 2007 14:07:59 +0000 Subject: [PATCH] branches/zip: Use mem_calloc and mem_heap_calloc when possible. row_ext_create(): After a memset() inside UNIV_DEBUG, flag the memory uninitialized with UNIV_MEM_ALLOC(). --- btr/btr0cur.c | 4 +--- include/row0ext.ic | 1 + row/row0mysql.c | 4 +--- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/btr/btr0cur.c b/btr/btr0cur.c index d610c0bf7b6..b3932f07a1a 100644 --- a/btr/btr0cur.c +++ b/btr/btr0cur.c @@ -3165,9 +3165,7 @@ btr_estimate_number_of_different_key_vals( n_cols = dict_index_get_n_unique(index); - n_diff = mem_alloc((n_cols + 1) * sizeof(ib_longlong)); - - memset(n_diff, 0, (n_cols + 1) * sizeof(ib_longlong)); + n_diff = mem_calloc((n_cols + 1) * sizeof(ib_longlong)); /* We sample some pages in the index to get an estimate */ diff --git a/include/row0ext.ic b/include/row0ext.ic index 75244aa8c13..bdd5557a2b6 100644 --- a/include/row0ext.ic +++ b/include/row0ext.ic @@ -43,6 +43,7 @@ row_ext_create( ret->buf = mem_heap_alloc(heap, n_ext * REC_MAX_INDEX_COL_LEN); #ifdef UNIV_DEBUG memset(ret->buf, 0xaa, n_ext * REC_MAX_INDEX_COL_LEN); + UNIV_MEM_ALLOC(ret->buf, n_ext * REC_MAX_INDEX_COL_LEN); #endif memset(ret->len, 0, n_ext * sizeof *ret->len); diff --git a/row/row0mysql.c b/row/row0mysql.c index 82aac4d9845..4c33bb38dc7 100644 --- a/row/row0mysql.c +++ b/row/row0mysql.c @@ -599,9 +599,7 @@ row_create_prebuilt( heap = mem_heap_create(sizeof *prebuilt + 128); - prebuilt = mem_heap_alloc(heap, sizeof *prebuilt); - - memset(prebuilt, 0, sizeof *prebuilt); + prebuilt = mem_heap_calloc(heap, sizeof *prebuilt); prebuilt->magic_n = ROW_PREBUILT_ALLOCATED; prebuilt->magic_n2 = ROW_PREBUILT_ALLOCATED;