summaryrefslogtreecommitdiffstats
path: root/core/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2017-12-10 22:28:35 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-12-11 00:17:39 +0100
commitae26875a61f38ad3be9d87d0ff8953d3f807c09a (patch)
tree321699fac8c0a7dbd326684c36301d6ccfeb889c /core/qthelper.cpp
parentea0cbba804d5809c60d538d56e5542c9fa305d27 (diff)
downloadsubsurface-ae26875a61f38ad3be9d87d0ff8953d3f807c09a.tar.gz
Use the copy_string() helper function in set_filename()
copy_string() does the same as the current code, but in one instead of four lines. Strictly speaking, it does not exactly the same thing because the empty string ("") case is handled differently. copy_string() returns NULL instead of a copy of "", which is probably preferred anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/qthelper.cpp')
-rw-r--r--core/qthelper.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index b63ea3929..341819a96 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -563,10 +563,7 @@ QLocale getLocale()
void set_filename(const char *filename)
{
free((void *)existing_filename);
- if (filename)
- existing_filename = strdup(filename);
- else
- existing_filename = NULL;
+ existing_filename = copy_string(filename);
}
const QString get_dc_nickname(const char *model, uint32_t deviceid)