Code

options: initialize options.list_format
authorMax Kellermann <max@duempel.org>
Thu, 2 Oct 2008 14:15:56 +0000 (16:15 +0200)
committerMax Kellermann <max@duempel.org>
Thu, 2 Oct 2008 14:15:56 +0000 (16:15 +0200)
Instead of checking whether options.list_format is set in the
LIST_FORMAT macro, initialize it once with options.list_format.  Same
for options.status_format / STATUS_FORMAT.

src/ncmpc.h
src/options.c

index ad6a6e302f80f681e5efdc35a43e20f6885b3cd8..746bc8beb7cb7d6b37ca8106ce398d28609f19e7 100644 (file)
 
 /* song format - list window */
 #define DEFAULT_LIST_FORMAT "%name%|[%artist% - ]%title%|%shortfile%"
-#define LIST_FORMAT (options.list_format ? options.list_format : \
-                                           DEFAULT_LIST_FORMAT)
+#define LIST_FORMAT options.list_format
 
 /* song format - status window */
 #define DEFAULT_STATUS_FORMAT "[%artist% - ]%title%|%shortfile%"
-#define STATUS_FORMAT (options.status_format ? options.status_format : \
-                                               DEFAULT_STATUS_FORMAT)
-                                                                                          
+#define STATUS_FORMAT options.status_format
+
 #define DEFAULT_LYRICS_TIMEOUT 100
 
 #define DEFAULT_SCROLL TRUE
index 5b2b47c478fc93be5bf3d9c905b264eb4b8c4fc5..f6e206aeabf82225a7493bb0d776b0660bc94d4f 100644 (file)
@@ -333,6 +333,8 @@ options_init( void )
                options.port = DEFAULT_PORT;
 
        /* default option values */
+       options.list_format = g_strdup(DEFAULT_LIST_FORMAT);
+       options.status_format = g_strdup(DEFAULT_STATUS_FORMAT);
        options.reconnect = TRUE;
        options.find_wrap = TRUE;
        options.wide_cursor = TRUE;