MCPcopy Create free account
hub / github.com/MariaDB/server / alloc_keys

Method alloc_keys

sql/table.cc:8574–8598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8572*/
8573
8574bool TABLE::alloc_keys(uint key_count)
8575{
8576 KEY *new_key_info;
8577 key_part_map *new_const_key_parts;
8578 DBUG_ASSERT(s->tmp_table == INTERNAL_TMP_TABLE);
8579
8580 if (!multi_alloc_root(&mem_root,
8581 &new_key_info, sizeof(*key_info)*(s->total_keys+key_count),
8582 &new_const_key_parts,
8583 sizeof(*new_const_key_parts)*(s->total_keys+key_count),
8584 NullS))
8585 return TRUE;
8586 if (s->total_keys)
8587 {
8588 memmove(new_key_info, s->key_info, sizeof(*key_info) * s->total_keys);
8589 memmove(new_const_key_parts, const_key_parts,
8590 s->total_keys * sizeof(const_key_parts));
8591 }
8592 s->key_info= key_info= new_key_info;
8593 const_key_parts= new_const_key_parts;
8594 bzero((char*) (const_key_parts + s->total_keys),
8595 sizeof(*const_key_parts) * key_count);
8596 max_keys= s->total_keys+key_count;
8597 return FALSE;
8598}
8599
8600
8601/**

Callers 2

initMethod · 0.80

Calls 1

multi_alloc_rootFunction · 0.85

Tested by

no test coverage detected