diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-02-28 23:37:09 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-03-14 13:55:36 +0200 |
commit | d1572a8d9574e80955796b8667317c8dbd376081 (patch) | |
tree | ab58f9920a20b5c55bd54474f2edcfdc4eb2b904 /desktop-widgets/locationinformation.cpp | |
parent | b72cc1f31784346884c8552c22f1e4c3c6d5ed1d (diff) | |
download | subsurface-d1572a8d9574e80955796b8667317c8dbd376081.tar.gz |
Cleanup: introduce copy_qstring() function
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common
occurrences that they seem worthy of a short helper-function.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/locationinformation.cpp')
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index 7818bc29e..0f3d2b4f3 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -158,7 +158,7 @@ void LocationInformationWidget::acceptChanges() { char *uiString; struct dive_site *currentDs; - uiString = copy_string(qPrintable(ui.diveSiteName->text())); + uiString = copy_qstring(ui.diveSiteName->text()); if (get_dive_site_by_uuid(displayed_dive_site.uuid) != NULL) { currentDs = get_dive_site_by_uuid(displayed_dive_site.uuid); } else { @@ -175,14 +175,14 @@ void LocationInformationWidget::acceptChanges() } else { free(uiString); } - uiString = copy_string(qPrintable(ui.diveSiteDescription->text())); + uiString = copy_qstring(ui.diveSiteDescription->text()); if (!same_string(uiString, currentDs->description)) { free(currentDs->description); currentDs->description = uiString; } else { free(uiString); } - uiString = copy_string(qPrintable(ui.diveSiteCountry->text())); + uiString = copy_qstring(ui.diveSiteCountry->text()); // if the user entered a different contriy, first update the taxonomy // for the displayed dive site; this below will get copied into the currentDs if (!same_string(uiString, taxonomy_get_country(&displayed_dive_site.taxonomy)) && @@ -193,7 +193,7 @@ void LocationInformationWidget::acceptChanges() // now update the currentDs (which we then later copy back ontop of displayed_dive_site copy_dive_site_taxonomy(&displayed_dive_site, currentDs); - uiString = copy_string(qPrintable(ui.diveSiteNotes->document()->toPlainText())); + uiString = copy_qstring(ui.diveSiteNotes->document()->toPlainText()); if (!same_string(uiString, currentDs->notes)) { free(currentDs->notes); currentDs->notes = uiString; |