mirror of
https://github.com/MariaDB/server.git
synced 2025-12-12 08:01:43 +03:00
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().
This commit is contained in:
@@ -3165,9 +3165,7 @@ btr_estimate_number_of_different_key_vals(
|
|||||||
|
|
||||||
n_cols = dict_index_get_n_unique(index);
|
n_cols = dict_index_get_n_unique(index);
|
||||||
|
|
||||||
n_diff = mem_alloc((n_cols + 1) * sizeof(ib_longlong));
|
n_diff = mem_calloc((n_cols + 1) * sizeof(ib_longlong));
|
||||||
|
|
||||||
memset(n_diff, 0, (n_cols + 1) * sizeof(ib_longlong));
|
|
||||||
|
|
||||||
/* We sample some pages in the index to get an estimate */
|
/* We sample some pages in the index to get an estimate */
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ row_ext_create(
|
|||||||
ret->buf = mem_heap_alloc(heap, n_ext * REC_MAX_INDEX_COL_LEN);
|
ret->buf = mem_heap_alloc(heap, n_ext * REC_MAX_INDEX_COL_LEN);
|
||||||
#ifdef UNIV_DEBUG
|
#ifdef UNIV_DEBUG
|
||||||
memset(ret->buf, 0xaa, n_ext * REC_MAX_INDEX_COL_LEN);
|
memset(ret->buf, 0xaa, n_ext * REC_MAX_INDEX_COL_LEN);
|
||||||
|
UNIV_MEM_ALLOC(ret->buf, n_ext * REC_MAX_INDEX_COL_LEN);
|
||||||
#endif
|
#endif
|
||||||
memset(ret->len, 0, n_ext * sizeof *ret->len);
|
memset(ret->len, 0, n_ext * sizeof *ret->len);
|
||||||
|
|
||||||
|
|||||||
@@ -599,9 +599,7 @@ row_create_prebuilt(
|
|||||||
|
|
||||||
heap = mem_heap_create(sizeof *prebuilt + 128);
|
heap = mem_heap_create(sizeof *prebuilt + 128);
|
||||||
|
|
||||||
prebuilt = mem_heap_alloc(heap, sizeof *prebuilt);
|
prebuilt = mem_heap_calloc(heap, sizeof *prebuilt);
|
||||||
|
|
||||||
memset(prebuilt, 0, sizeof *prebuilt);
|
|
||||||
|
|
||||||
prebuilt->magic_n = ROW_PREBUILT_ALLOCATED;
|
prebuilt->magic_n = ROW_PREBUILT_ALLOCATED;
|
||||||
prebuilt->magic_n2 = ROW_PREBUILT_ALLOCATED;
|
prebuilt->magic_n2 = ROW_PREBUILT_ALLOCATED;
|
||||||
|
|||||||
Reference in New Issue
Block a user