mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
Use free_and_zero where possible in bmpx.cc
This commit is contained in:
parent
ad1b72ed94
commit
c2c58cd8d7
15
src/bmpx.cc
15
src/bmpx.cc
@ -86,18 +86,9 @@ void update_bmpx()
|
|||||||
G_TYPE_INT, current_track, G_TYPE_INVALID,
|
G_TYPE_INT, current_track, G_TYPE_INVALID,
|
||||||
DBUS_TYPE_G_STRING_VALUE_HASHTABLE, &metadata,
|
DBUS_TYPE_G_STRING_VALUE_HASHTABLE, &metadata,
|
||||||
G_TYPE_INVALID)) {
|
G_TYPE_INVALID)) {
|
||||||
if (current_info->bmpx.title) {
|
free_and_zero(current_info->bmpx.title);
|
||||||
free(current_info->bmpx.title);
|
free_and_zero(current_info->bmpx.artist);
|
||||||
current_info->bmpx.title = 0;
|
free_and_zero(current_info->bmpx.album);
|
||||||
}
|
|
||||||
if (current_info->bmpx.artist) {
|
|
||||||
free(current_info->bmpx.artist);
|
|
||||||
current_info->bmpx.artist = 0;
|
|
||||||
}
|
|
||||||
if (current_info->bmpx.album) {
|
|
||||||
free(current_info->bmpx.album);
|
|
||||||
current_info->bmpx.album = 0;
|
|
||||||
}
|
|
||||||
current_info->bmpx.title =
|
current_info->bmpx.title =
|
||||||
g_value_dup_string(g_hash_table_lookup(metadata, "title"));
|
g_value_dup_string(g_hash_table_lookup(metadata, "title"));
|
||||||
current_info->bmpx.artist =
|
current_info->bmpx.artist =
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define free_and_zero(PTR) if(PTR) { free(PTR); PTR = NULL; }
|
#define free_and_zero(PTR) if(PTR) free(PTR); PTR = NULL;
|
||||||
|
|
||||||
#ifndef _CONKY_CORE_H_
|
#ifndef _CONKY_CORE_H_
|
||||||
#define _CONKY_CORE_H_
|
#define _CONKY_CORE_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user