-
Dave Gosselin authored
Ideally our methods and functions should do one thing, do that well, and do only that. add_table_to_list does far more than adding a table to a list, so this commit factors the TABLE_LIST creation out to a new TABLE_LIST constructor. It then uses placement new() to create it in the correct memory area (result of thd->calloc). Benefits of this approach: 1. add_table_to_list now returns as early as possible on an error 2. fewer side-effects incurred on creating the TABLE_LIST object 3. TABLE_LIST won't be calloc'd if copy_to_db fails 4. local declarations moved closer to their respective first uses 5. improved code readability and logical flow Also factored a couple of other functions to keep the happy path more to the left, which makes them easier to follow at a glance.
a8a75ba2