mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: copy string in taxonomy_set_[country|category]
These functions were taking a const char *, yet taking ownership of the value. Moreover, taking ownership of strings is rather unusual in C-style APIs. Let's copy the string instead. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
6da78a29c4
commit
55e4237306
2 changed files with 2 additions and 2 deletions
|
@ -268,7 +268,7 @@ bool EditDiveSiteCountry::workToBeDone()
|
||||||
void EditDiveSiteCountry::redo()
|
void EditDiveSiteCountry::redo()
|
||||||
{
|
{
|
||||||
QString old = taxonomy_get_country(&ds->taxonomy);
|
QString old = taxonomy_get_country(&ds->taxonomy);
|
||||||
taxonomy_set_country(&ds->taxonomy, copy_qstring(value), taxonomy_origin::GEOMANUAL);
|
taxonomy_set_country(&ds->taxonomy, qPrintable(value), taxonomy_origin::GEOMANUAL);
|
||||||
value = old;
|
value = old;
|
||||||
emit diveListNotifier.diveSiteChanged(ds, LocationInformationModel::TAXONOMY); // Inform frontend of changed dive site.
|
emit diveListNotifier.diveSiteChanged(ds, LocationInformationModel::TAXONOMY); // Inform frontend of changed dive site.
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ void taxonomy_set_category(struct taxonomy_data *t, enum taxonomy_category categ
|
||||||
}
|
}
|
||||||
idx = t->nr++;
|
idx = t->nr++;
|
||||||
}
|
}
|
||||||
t->category[idx].value = value;
|
t->category[idx].value = strdup(value);
|
||||||
t->category[idx].origin = origin;
|
t->category[idx].origin = origin;
|
||||||
t->category[idx].category = category;
|
t->category[idx].category = category;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue