1
0
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:
Nikolas Garofil 2010-02-22 22:03:14 +01:00
parent ad1b72ed94
commit c2c58cd8d7
2 changed files with 4 additions and 13 deletions

View File

@ -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 =

View File

@ -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_