mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: port filterpreset.cpp to std::string
Less memory management hassle. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
5d36ba4593
commit
68ddce5b11
11 changed files with 44 additions and 57 deletions
|
@ -641,20 +641,17 @@ static void save_filter_presets(struct membuffer *b)
|
|||
return;
|
||||
put_format(b, "<filterpresets>\n");
|
||||
for (i = 0; i < filter_presets_count(); i++) {
|
||||
char *name, *fulltext;
|
||||
name = filter_preset_name(i);
|
||||
std::string name = filter_preset_name(i);
|
||||
put_format(b, " <filterpreset");
|
||||
show_utf8(b, name, " name='", "'", 1);
|
||||
show_utf8(b, name.c_str(), " name='", "'", 1);
|
||||
put_format(b, ">\n");
|
||||
free(name);
|
||||
|
||||
fulltext = filter_preset_fulltext_query(i);
|
||||
if (!empty_string(fulltext)) {
|
||||
std::string fulltext = filter_preset_fulltext_query(i);
|
||||
if (!fulltext.empty()) {
|
||||
const char *fulltext_mode = filter_preset_fulltext_mode(i);
|
||||
show_utf8(b, fulltext_mode, " <fulltext mode='", "'>", 1);
|
||||
show_utf8(b, fulltext, "", "</fulltext>\n", 0);
|
||||
show_utf8(b, fulltext.c_str(), "", "</fulltext>\n", 0);
|
||||
}
|
||||
free(fulltext);
|
||||
|
||||
for (int j = 0; j < filter_preset_constraint_count(i); j++) {
|
||||
const struct filter_constraint *constraint = filter_preset_constraint(i, j);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue