changeset 34576:7596714e9e76

Replace string constants by symbolic constants. This allows definition at one single location.
author ib
date Thu, 09 Feb 2012 12:52:09 +0000
parents 5d9183107441
children 22887c794c02
files gui/cfg.c gui/win32/wincfg.c
diffstat 2 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/gui/cfg.c	Thu Feb 09 12:43:09 2012 +0000
+++ b/gui/cfg.c	Thu Feb 09 12:52:09 2012 +0000
@@ -43,6 +43,11 @@
 #include "sub/font_load.h"
 #include "sub/sub.h"
 
+#define GUI_CONFIGURATION "gui.conf"
+#define GUI_HISTORY       "gui.history"
+#define GUI_PLAYLIST      "gui.pl"
+#define GUI_URLLIST       "gui.url"
+
 m_config_t *gui_conf;
 
 int gtkCacheOn;
@@ -242,7 +247,7 @@
 
     // configuration
 
-    cfg = get_path("gui.conf");
+    cfg = get_path(GUI_CONFIGURATION);
 
     mp_msg(MSGT_GPLAYER, MSGL_DBG2, "[cfg] file: %s\n", cfg);
 
@@ -264,7 +269,7 @@
 
     // playlist
 
-    cfg = get_path("gui.pl");
+    cfg = get_path(GUI_PLAYLIST);
     f   = fopen(cfg, "rt");
 
     if (f) {
@@ -289,7 +294,7 @@
 
     // URL list
 
-    cfg = get_path("gui.url");
+    cfg = get_path(GUI_URLLIST);
     f   = fopen(cfg, "rt");
 
     if (f) {
@@ -312,7 +317,7 @@
 
     // directory history
 
-    cfg = get_path("gui.history");
+    cfg = get_path(GUI_HISTORY);
     f   = fopen(cfg, "rt+");
 
     if (f) {
@@ -341,7 +346,7 @@
 
     // configuration
 
-    cfg = get_path("gui.conf");
+    cfg = get_path(GUI_CONFIGURATION);
     f   = fopen(cfg, "wt+");
 
     if (f) {
@@ -366,7 +371,7 @@
 
     // playlist
 
-    cfg = get_path("gui.pl");
+    cfg = get_path(GUI_PLAYLIST);
     f   = fopen(cfg, "wt+");
 
     if (f) {
@@ -388,7 +393,7 @@
 
     // URL list
 
-    cfg = get_path("gui.url");
+    cfg = get_path(GUI_URLLIST);
     f   = fopen(cfg, "wt+");
 
     if (f) {
@@ -406,7 +411,7 @@
 
     // directory history
 
-    cfg = get_path("gui.history");
+    cfg = get_path(GUI_HISTORY);
     f   = fopen(cfg, "wt+");
 
     if (f) {
--- a/gui/win32/wincfg.c	Thu Feb 09 12:43:09 2012 +0000
+++ b/gui/win32/wincfg.c	Thu Feb 09 12:52:09 2012 +0000
@@ -38,6 +38,8 @@
 #include "gui/interface.h"
 #include "gui.h"
 
+#define GUI_CONFIGURATION "gui.conf"
+
 /* params */
 int   gtkAONorm = 0;
 int   gtkAOExtraStereo = 0;
@@ -95,7 +97,7 @@
 
 void cfg_read(void)
 {
-    char *cfg = get_path("gui.conf");
+    char *cfg = get_path(GUI_CONFIGURATION);
 
     player_idle_mode = 1;   // GUI is in idle mode by default
 
@@ -110,7 +112,7 @@
 
 void cfg_write(void)
 {
-    char *cfg = get_path("gui.conf");
+    char *cfg = get_path(GUI_CONFIGURATION);
     FILE *f;
     int i;