mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
31cd8346ae
Before, we stored only the report string itself for a string list in field->report_string. The field->report_string has either sorted items or not, depending on what we need for a field - some report fields have sorted output, some don't... The field->sort_value.value then contains pointer to the exact field->report_string. The field->sort_value.items ALWAYS keeps sorted array of individual items, represented as '[position,length]' pairs pointing to the field->sort_value.value string. This approach was fine as far as we didn't need to apply further formatting to field->report_string. However, if we need to apply further formatting to field->report_string content, taking into account individual items, we also need to know where each item starts and what is its length. Before, we only knew this when items in report string were sorted, but not in the unsorted version. We can't rely on the delimiter (default ",") only to separate items back out of report string, because that delimiter can be contained in the item value itself. So this patch enhances the field->report_string for a string list so it also contains '[position,length]' pairs for each individual item inside field->report_string. We store this array right beyond the string itself and we encode it in the same manner we already did for field->sort_value.items before. If field->report_string has sorted items, the field->sort_value.items just points to the array of items we store beyond the report string. If field->report_string has unsorted items, we store separate array of items for both field->report_string and field->sort_value. This patch also cleans up the _report_field_string_list function a bit so it's easier and more straightforward to follow than the original version. Example. If we have "abc", "xy", "defgh" as list on input with "," as delimiter, then: - field->report_string will have: - if we need field->report_string unsorted: abc,xy,defgh\0{[3,12],[0,3],[4,2],[7,5]} |____________||________________________| string array of [pos,len] pairs |____||________________| #items items - if we need field->report_string sorted: repstr_extra | V abc,defgh,xy\0{[3,12],[0,3],[4,5],[10,2]} |____________||________________________| string array of [pos,len] pairs |____||________________| #items items - field->sort_value will have: - if field->report_string is unsorted: field->sort_value.value = field->report_string field->sort_value.items = {[0,3],[0,3],[7,5],[4,2]} (that is 'abc,defgh,xy') - if field->report_string is sorted already: field->sort_value.value = field->report_string field->sort_value.items = repstr_extra (that is also 'abc,defgh,xy') |
||
---|---|---|
.. | ||
datastruct | ||
dm-tools | ||
ioctl | ||
misc | ||
mm | ||
regex | ||
.exported_symbols | ||
.exported_symbols.Base | ||
.exported_symbols.DM_1_02_97 | ||
.exported_symbols.DM_1_02_98 | ||
.exported_symbols.DM_1_02_99 | ||
.exported_symbols.DM_1_02_100 | ||
.exported_symbols.DM_1_02_101 | ||
.exported_symbols.DM_1_02_103 | ||
.exported_symbols.DM_1_02_104 | ||
.exported_symbols.DM_1_02_105 | ||
.exported_symbols.DM_1_02_106 | ||
.exported_symbols.DM_1_02_107 | ||
.exported_symbols.DM_1_02_110 | ||
.exported_symbols.DM_1_02_113 | ||
.exported_symbols.DM_1_02_124 | ||
.exported_symbols.DM_1_02_128 | ||
.exported_symbols.DM_1_02_129 | ||
.exported_symbols.DM_1_02_131 | ||
.exported_symbols.DM_1_02_133 | ||
.exported_symbols.DM_1_02_135 | ||
.exported_symbols.DM_1_02_138 | ||
.exported_symbols.DM_1_02_141 | ||
.exported_symbols.DM_1_02_147 | ||
.exported_symbols.DM_1_02_172 | ||
.exported_symbols.DM_1_02_181 | ||
libdevmapper.h | ||
libdevmapper.pc.in | ||
libdm-common.c | ||
libdm-common.h | ||
libdm-config.c | ||
libdm-deptree.c | ||
libdm-file.c | ||
libdm-report.c | ||
libdm-stats.c | ||
libdm-string.c | ||
libdm-targets.c | ||
libdm-timestamp.c | ||
make.tmpl.in | ||
Makefile.in |