@@ -1431,48 +1431,38 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
1431
1431
1432
1432
DBUG_PRINT (" info" ,(" i_count: %d i_parts: %d index: %d n_length: %d int_length: %d com_length: %d vcol_screen_length: %d" , interval_count,interval_parts, keys,n_length,int_length, com_length, vcol_screen_length));
1433
1433
1434
+ if (!multi_alloc_root (&share->mem_root ,
1435
+ &share->field , (uint)(share->fields +1 )*sizeof (Field*),
1436
+ &share->intervals , (uint)interval_count*sizeof (TYPELIB),
1437
+ &share->check_constraints , (uint) share->table_check_constraints * sizeof (Virtual_column_info*),
1438
+ &interval_array, (uint) (share->fields +interval_parts+ keys+3 )*sizeof (char *),
1439
+ &names, (uint) (n_length+int_length),
1440
+ &comment_pos, (uint) com_length,
1441
+ &vcol_screen_pos, vcol_screen_length,
1442
+ NullS))
1434
1443
1435
- if (!(field_ptr = (Field **)
1436
- alloc_root (&share->mem_root ,
1437
- (uint) ((share->fields +1 )*sizeof (Field*)+
1438
- interval_count*sizeof (TYPELIB)+
1439
- share->table_check_constraints *
1440
- sizeof (Virtual_column_info*)+
1441
- (share->fields +interval_parts+
1442
- keys+3 )*sizeof (char *)+
1443
- (n_length+int_length+com_length+
1444
- vcol_screen_length)))))
1445
- goto err; /* purecov: inspected */
1446
-
1447
- share->field = field_ptr;
1444
+ goto err;
1445
+
1446
+ field_ptr= share->field ;
1447
+ table_check_constraints= share->check_constraints ;
1448
1448
read_length=(uint) (share->fields * field_pack_length +
1449
1449
pos+ (uint) (n_length+int_length+com_length+
1450
1450
vcol_screen_length));
1451
1451
strpos= disk_buff+pos;
1452
1452
1453
- share->intervals = (TYPELIB*) (field_ptr+share->fields +1 );
1454
- share->check_constraints = ((Virtual_column_info**)
1455
- (share->intervals +interval_count));
1456
- table_check_constraints= share->check_constraints ;
1457
- interval_array= (const char **) (table_check_constraints+
1458
- share->table_check_constraints );
1459
- names= (char *) (interval_array+share->fields +interval_parts+keys+3 );
1460
1453
if (!interval_count)
1461
1454
share->intervals = 0 ; // For better debugging
1462
- memcpy ((char *) names, strpos+(share->fields *field_pack_length),
1463
- (uint) (n_length+int_length));
1464
- comment_pos= names+(n_length+int_length);
1455
+
1456
+ memcpy (names, strpos+(share->fields *field_pack_length), n_length+int_length);
1465
1457
memcpy (comment_pos, disk_buff+read_length-com_length-vcol_screen_length,
1466
1458
com_length);
1467
- vcol_screen_pos= (uchar*) (names+(n_length+int_length+com_length));
1468
1459
memcpy (vcol_screen_pos, disk_buff+read_length-vcol_screen_length,
1469
1460
vcol_screen_length);
1470
1461
1471
1462
fix_type_pointers (&interval_array, &share->fieldnames , 1 , &names);
1472
1463
if (share->fieldnames .count != share->fields )
1473
1464
goto err;
1474
- fix_type_pointers (&interval_array, share->intervals , interval_count,
1475
- &names);
1465
+ fix_type_pointers (&interval_array, share->intervals , interval_count, &names);
1476
1466
1477
1467
{
1478
1468
/* Set ENUM and SET lengths */
0 commit comments