mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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>
This commit is contained in:
parent
ea0cbba804
commit
ae26875a61
1 changed files with 1 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue