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
@ -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…
x
Reference in New Issue
Block a user