Commit a6fd73b7 authored by Nikita Malyavin's avatar Nikita Malyavin

rewrite fill_extra2 to ordinary function

parent 5887de00
......@@ -1500,6 +1500,14 @@ static size_t extra2_read_len(const uchar **extra2, const uchar *extra2_end)
return length;
}
static
bool fill_unique_extra2(const uchar *extra2, size_t len, LEX_CUSTRING *section)
{
if (section->str)
return true;
*section= {extra2, len};
return false;
}
static
bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields)
......@@ -1520,13 +1528,6 @@ bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields)
if (!length)
DBUG_RETURN(true);
auto fill_extra2= [extra2, length](LEX_CUSTRING *section){
if (section->str)
return true;
*section= {extra2, length};
return false;
};
bool fail= false;
switch (type) {
case EXTRA2_TABLEDEF_VERSION:
......@@ -1542,29 +1543,29 @@ bool read_extra2(const uchar *frm_image, size_t len, extra2_fields *fields)
}
break;
case EXTRA2_ENGINE_TABLEOPTS:
fail= fill_extra2(&fields->options);
fail= fill_unique_extra2(extra2, length, &fields->options);
break;
case EXTRA2_DEFAULT_PART_ENGINE:
fields->engine.set((const char*)extra2, length);
break;
case EXTRA2_GIS:
fail= fill_extra2(&fields->gis);
fail= fill_unique_extra2(extra2, length, &fields->gis);
break;
case EXTRA2_PERIOD_FOR_SYSTEM_TIME:
fail= fill_extra2(&fields->system_period)
fail= fill_unique_extra2(extra2, length, &fields->system_period)
|| length != 2 * frm_fieldno_size;
break;
case EXTRA2_FIELD_FLAGS:
fail= fill_extra2(&fields->field_flags);
fail= fill_unique_extra2(extra2, length, &fields->field_flags);
break;
case EXTRA2_APPLICATION_TIME_PERIOD:
fail= fill_extra2(&fields->application_period);
fail= fill_unique_extra2(extra2, length, &fields->application_period);
break;
case EXTRA2_PERIOD_WITHOUT_OVERLAPS:
fail= fill_extra2(&fields->without_overlaps);
fail= fill_unique_extra2(extra2, length, &fields->without_overlaps);
break;
case EXTRA2_FIELD_DATA_TYPE_INFO:
fail= fill_extra2(&fields->field_data_type_info);
fail= fill_unique_extra2(extra2, length, &fields->field_data_type_info);
break;
default:
/* abort frm parsing if it's an unknown but important extra2 value */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment