| 1 | /***************************************************************************** |
| 2 | |
| 3 | Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. |
| 4 | Copyright (c) 2017, 2021, MariaDB Corporation. |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify it under |
| 7 | the terms of the GNU General Public License as published by the Free Software |
| 8 | Foundation; version 2 of the License. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 12 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU General Public License along with |
| 15 | this program; if not, write to the Free Software Foundation, Inc., |
| 16 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA |
| 17 | |
| 18 | *****************************************************************************/ |
| 19 | |
| 20 | /******************************************************************//** |
| 21 | @file include/dict0mem.ic |
| 22 | Data dictionary memory object creation |
| 23 | |
| 24 | Created 1/8/1996 Heikki Tuuri |
| 25 | ***********************************************************************/ |
| 26 | |
| 27 | #include "data0type.h"cxx . . $ `<file>/storage/innobase/include/data0type.h`/ |
| 28 | #include "dict0mem.h"cxx . . $ `<file>/storage/innobase/include/dict0mem.h`/ |
| 29 | #include "fil0fil.h"cxx . . $ `<file>/storage/innobase/include/fil0fil.h`/ |
| 30 | |
| 31 | /**********************************************************************//** |
| 32 | This function poplulates a dict_index_t index memory structure with |
| 33 | supplied information. */ |
| 34 | UNIV_INLINEcxx . . $ `storage/innobase/include/univ.i:168:9`! |
| 35 | void |
| 36 | dict_mem_fill_index_structcxx . . $ dict_mem_fill_index_struct(712dcaf71849f6c4).( |
| 37 | /*=======================*/ |
| 38 | dict_index_tcxx . . $ dict_index_t#* index, /*!< out: index to be filled */ |
| 39 | mem_heap_tcxx . . $ mem_heap_t#* heap, /*!< in: memory heap */ |
| 40 | const char* index_name, /*!< in: index name */ |
| 41 | ulintcxx . . $ ulint# type, /*!< in: DICT_UNIQUE, |
| 42 | DICT_CLUSTERED, ... ORed */ |
| 43 | ulintcxx . . $ ulint# n_fields) /*!< in: number of fields */ |
| 44 | { |
| 45 | |
| 46 | if (heap) { |
| 47 | index->heapcxx . . $ dict_index_t#heap. = heap; |
| 48 | index->namecxx . . $ dict_index_t#name. =cxx . . $ id_name_t#`operator=`(828bc1359dcaff23). mem_heap_strdupcxx . . $ mem_heap_strdup(ccac314bc9d3d20f).(heap, index_name); |
| 49 | index->fieldscxx . . $ dict_index_t#fields. = (dict_field_tcxx . . $ dict_field_t#*) mem_heap_alloccxx . . $ mem_heap_alloc(3f50e4c8b9ca77c0).( |
| 50 | heap, 1 + n_fields * sizeof(dict_field_tcxx . . $ dict_field_t#)); |
| 51 | } else { |
| 52 | index->namecxx . . $ dict_index_t#name. =cxx . . $ id_name_t#`operator=`(828bc1359dcaff23). index_name; |
| 53 | index->heapcxx . . $ dict_index_t#heap. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 54 | index->fieldscxx . . $ dict_index_t#fields. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:416:9`!; |
| 55 | } |
| 56 | |
| 57 | index->typecxx . . $ dict_index_t#type. = type & ((1U << DICT_IT_BITScxx . . $ `storage/innobase/include/dict0mem.h:77:9`!) - 1); |
| 58 | index->pagecxx . . $ dict_index_t#page. = FIL_NULLcxx . . $ `storage/innobase/include/fil0fil.h:1175:9`!; |
| 59 | index->merge_thresholdcxx . . $ dict_index_t#merge_threshold. = DICT_INDEX_MERGE_THRESHOLD_DEFAULTcxx . . $ `storage/innobase/include/dict0mem.h:972:10`!; |
| 60 | index->n_fieldscxx . . $ dict_index_t#n_fields. = static_cast<unsigned>(n_fields) |
| 61 | & index->MAX_N_FIELDScxx . . $ dict_index_t#MAX_N_FIELDS.; |
| 62 | index->n_core_fieldscxx . . $ dict_index_t#n_core_fields. = static_cast<unsigned>(n_fields) |
| 63 | & index->MAX_N_FIELDScxx . . $ dict_index_t#MAX_N_FIELDS.; |
| 64 | /* The '1 +' above prevents allocation |
| 65 | of an empty mem block */ |
| 66 | ut_dcxx . . $ `storage/innobase/include/ut0dbg.h:68:9`!(index->magic_n = DICT_INDEX_MAGIC_N); |
| 67 | } |