summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 93c2a81)
raw | patch | inline | side by side (parent: 93c2a81)
author | Max Kellermann <max@duempel.org> | |
Thu, 2 Oct 2008 15:47:01 +0000 (17:47 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 2 Oct 2008 15:47:01 +0000 (17:47 +0200) |
Use the standard "bool" type instead of glib's "gboolean". This way,
options.h doesn't have to include the fat glib.h.
options.h doesn't have to include the fat glib.h.
src/conf.c | patch | blob | history | |
src/options.c | patch | blob | history | |
src/options.h | patch | blob | history |
diff --git a/src/conf.c b/src/conf.c
index e0214ce9d58a8bfa56cd39e973cfcc70e5d36aec..66f125d0d25763a5a8859ab949b6de768ddce3f7 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
KEY_PARSER_DONE
} key_parser_state_t;
-static gboolean
+static bool
str2bool(char *str)
{
- if (!strcasecmp(str, "yes") || !strcasecmp(str, "true") ||
- !strcasecmp(str, "on") || !strcasecmp(str, "1"))
- return TRUE;
- return FALSE;
+ return strcasecmp(str, "yes") == 0 || strcasecmp(str, "true") == 0 ||
+ strcasecmp(str, "on") == 0 || strcasecmp(str, "1") == 0;
}
static int
diff --git a/src/options.c b/src/options.c
index 2a02dca74254fa5f3094c1ac5dcf5575e77e7591..421eda7d86c65c1c9ad5cde1d797c4bba22b8cf8 100644 (file)
--- a/src/options.c
+++ b/src/options.c
printf("\n");
exit(EXIT_SUCCESS);
case 'c': /* --colors */
- options.enable_colors = TRUE;
+ options.enable_colors = true;
break;
case 'C': /* --no-colors */
- options.enable_colors = FALSE;
+ options.enable_colors = false;
break;
case 'm': /* --mouse */
- options.enable_mouse = TRUE;
+ options.enable_mouse = true;
break;
case 'M': /* --no-mouse */
- options.enable_mouse = FALSE;
+ options.enable_mouse = false;
break;
case 'e': /* --exit */
- options.reconnect = FALSE;
+ options.reconnect = false;
break;
case 'p': /* --port */
options.port = atoi(arg);
exit(EXIT_SUCCESS);
break;
case 'D': /* --debug */
- options.debug = TRUE;
+ options.debug = true;
break;
#endif
default:
/* 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;
- options.welcome_screen_list = TRUE;
- options.audible_bell = TRUE;
+ options.reconnect = true;
+ options.find_wrap = true;
+ options.wide_cursor = true;
+ options.welcome_screen_list = true;
+ options.audible_bell = true;
options.crossfade_time = DEFAULT_CROSSFADE_TIME;
options.seek_time = 1;
options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0);
diff --git a/src/options.h b/src/options.h
index f29014cbd19f91fa26beb0aa5b01a6f6e964c35a..70853f4ff1f3180edc028710e02b9bff8d18f6e3 100644 (file)
--- a/src/options.h
+++ b/src/options.h
#ifndef OPTIONS_H
#define OPTIONS_H
-#include <glib.h>
+#include <stdbool.h>
#define MPD_HOST_ENV "MPD_HOST"
#define MPD_PORT_ENV "MPD_PORT"
int hide_cursor;
int seek_time;
int lyrics_timeout;
- gboolean reconnect;
- gboolean debug;
- gboolean find_wrap;
- gboolean find_show_last_pattern;
- gboolean list_wrap;
- gboolean auto_center;
- gboolean wide_cursor;
- gboolean enable_colors;
- gboolean audible_bell;
- gboolean visible_bell;
- gboolean enable_xterm_title;
- gboolean enable_mouse;
- gboolean scroll;
- gboolean visible_bitrate;
- gboolean welcome_screen_list;
+ bool reconnect;
+ bool debug;
+ bool find_wrap;
+ bool find_show_last_pattern;
+ bool list_wrap;
+ bool auto_center;
+ bool wide_cursor;
+ bool enable_colors;
+ bool audible_bell;
+ bool visible_bell;
+ bool enable_xterm_title;
+ bool enable_mouse;
+ bool scroll;
+ bool visible_bitrate;
+ bool welcome_screen_list;
} options_t;
#ifndef NO_GLOBAL_OPTIONS