aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-02 15:44:21 +0200
committerMax Kellermann <max@duempel.org>2008-10-02 15:44:21 +0200
commit36470979d9f3518217fc26987558dafb3ab36f5c (patch)
tree5ebeb5b306faafca9c52f1696f4be9851b4fa9b1 /src
parent9526f180e6f55654c99bd8d66c71612a32b0fb4e (diff)
downloadmpd-36470979d9f3518217fc26987558dafb3ab36f5c.tar.gz
mpd-36470979d9f3518217fc26987558dafb3ab36f5c.tar.xz
mpd-36470979d9f3518217fc26987558dafb3ab36f5c.zip
removed the debugging function D()
gdb is for debugging. We don't need D() calls littered all over.
Diffstat (limited to '')
-rw-r--r--src/conf.c7
-rw-r--r--src/main.c21
-rw-r--r--src/mpdclient.c28
-rw-r--r--src/ncmpc.h6
-rw-r--r--src/options.c1
-rw-r--r--src/screen.c4
-rw-r--r--src/screen_artist.c1
-rw-r--r--src/screen_browser.c1
-rw-r--r--src/screen_file.c1
-rw-r--r--src/screen_play.c5
-rw-r--r--src/screen_search.c3
-rw-r--r--src/support.c2
-rw-r--r--src/utils.c3
13 files changed, 1 insertions, 82 deletions
diff --git a/src/conf.c b/src/conf.c
index 557024dc5..79bbfd3a1 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -362,7 +362,6 @@ read_rc_file(char *filename, options_t *options)
if( filename==NULL )
return -1;
- D("Reading configuration file %s\n", filename);
if( (fd=open(filename,O_RDONLY)) <0 )
{
perror(filename);
@@ -474,8 +473,6 @@ read_rc_file(char *filename, options_t *options)
{
g_free(options->timedisplay_type);
options->timedisplay_type=g_strdup(parse_timedisplay_type(value));
- D("deb");
- D(options->timedisplay_type);
}
/* color definition */
else if( !strcasecmp(CONF_COLOR_DEFINITION, name) )
@@ -587,14 +584,10 @@ read_rc_file(char *filename, options_t *options)
fprintf(stderr,
_("Unknown configuration parameter: %s\n"),
name);
- D("conf> %s = %s %s\n", name, value,
- match_found ? "" : "- UNKNOWN SETTING!" );
}
}
}
- D("--\n\n");
-
if( free_filename )
g_free(filename);
diff --git a/src/main.c b/src/main.c
index 28cce938f..f6043d48a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -67,7 +67,6 @@ static void
error_callback(mpd_unused mpdclient_t *c, gint error, const gchar *msg)
{
error = error & 0xFF;
- D("Error [%d:%d]> \"%s\"\n", error, GET_ACK_ERROR_CODE(error), msg);
switch (error) {
case MPD_ERROR_CONNPORT:
case MPD_ERROR_NORESPONSE:
@@ -138,7 +137,6 @@ catch_sigint(mpd_unused int sig)
static void
catch_sigcont(mpd_unused int sig)
{
- D("catch_sigcont()\n");
#ifdef ENABLE_RAW_MODE
reset_prog_mode(); /* restore tty modes */
refresh();
@@ -179,24 +177,6 @@ catch_sigwinch(mpd_unused int sig)
timer_sigwinch_id = g_timeout_add(100, timer_sigwinch, NULL);
}
-#ifndef NDEBUG
-void
-D(const char *format, ...)
-{
- if( options.debug )
- {
- gchar *msg;
- va_list ap;
-
- va_start(ap,format);
- msg = g_strdup_vprintf(format,ap);
- va_end(ap);
- fprintf(stderr, "%s", msg);
- g_free(msg);
- }
-}
-#endif
-
static gboolean
timer_mpd_update(gpointer data);
@@ -351,7 +331,6 @@ main(int argc, const char *argv[])
setlocale(LC_CTYPE,"");
/* initialize charset conversions */
charset_init(g_get_charset(&charset));
- D("charset: %s\n", charset);
#endif
/* initialize i18n support */
diff --git a/src/mpdclient.c b/src/mpdclient.c
index 5098226d4..dbf285e07 100644
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
@@ -232,10 +232,6 @@ mpdclient_update(mpdclient_t *c)
c->status = mpd_getStatus(c->connection);
if ((retval=mpdclient_finish_command(c)))
return retval;
-#ifndef NDEBUG
- if (c->status->error)
- D("status> %s\n", c->status->error);
-#endif
/* check if the playlist needs an update */
if (c->playlist.id != c->status->playlist) {
@@ -266,7 +262,6 @@ mpdclient_cmd_play(mpdclient_t *c, gint idx)
#ifdef ENABLE_SONG_ID
struct mpd_song *song = playlist_get_song(c, idx);
- D("Play id:%d\n", song ? song->id : -1);
if (song)
mpd_sendPlayIdCommand(c->connection, song->id);
else
@@ -344,7 +339,6 @@ mpdclient_cmd_prev(mpdclient_t *c)
gint
mpdclient_cmd_seek(mpdclient_t *c, gint id, gint pos)
{
- D("Seek id:%d\n", id);
mpd_sendSeekIdCommand(c->connection, id, pos);
return mpdclient_finish_command(c);
}
@@ -465,7 +459,6 @@ mpdclient_cmd_delete(mpdclient_t *c, gint idx)
/* send the delete command to mpd */
#ifdef ENABLE_SONG_ID
- D("Delete id:%d\n", song->id);
mpd_sendDeleteIdCommand(c->connection, song->id);
#else
mpd_sendDeleteCommand(c->connection, idx);
@@ -513,10 +506,8 @@ mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index)
/* send the move command to mpd */
#ifdef ENABLE_SONG_ID
- D("Swapping id:%d with id:%d\n", song1->id, song2->id);
mpd_sendSwapIdCommand(c->connection, song1->id, song2->id);
#else
- D("Moving index %d to id:%d\n", old_index, new_index);
mpd_sendMoveCommand(c->connection, old_index, new_index);
#endif
if( (n=mpdclient_finish_command(c)) )
@@ -534,7 +525,6 @@ mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index)
#endif
/* call playlist updated callback */
- D("move> new_index=%d, old_index=%d\n", new_index, old_index);
mpdclient_playlist_callback(c, PLAYLIST_EVENT_MOVE, (gpointer) &new_index);
return 0;
@@ -668,8 +658,6 @@ mpdclient_playlist_update(mpdclient_t *c)
{
mpd_InfoEntity *entity;
- D("mpdclient_playlist_update() [%lld]\n", c->status->playlist);
-
if (MPD_ERROR(c))
return -1;
@@ -700,9 +688,6 @@ mpdclient_playlist_update_changes(mpdclient_t *c)
{
mpd_InfoEntity *entity;
- D("mpdclient_playlist_update_changes() [%lld -> %lld]\n",
- c->status->playlist, c->playlist.id);
-
if (MPD_ERROR(c))
return -1;
@@ -713,12 +698,9 @@ mpdclient_playlist_update_changes(mpdclient_t *c)
if (song->pos >= 0 && (guint)song->pos < c->playlist.list->len) {
/* update song */
- D("updating pos:%d, id=%d - %s\n",
- song->pos, song->id, song->file);
playlist_replace(&c->playlist, song->pos, song);
} else {
/* add a new song */
- D("adding song at pos %d\n", song->pos);
playlist_append(&c->playlist, song);
}
@@ -730,7 +712,6 @@ mpdclient_playlist_update_changes(mpdclient_t *c)
guint pos = c->playlist.list->len - 1;
/* Remove the last playlist entry */
- D("removing song at pos %d\n", pos);
playlist_remove(&c->playlist, pos);
}
@@ -763,7 +744,6 @@ mpdclient_filelist_get(mpdclient_t *c, const gchar *path)
gchar *path_utf8 = locale_to_utf8(path);
gboolean has_dirs_only = TRUE;
- D("mpdclient_filelist_get(%s)\n", path);
mpd_sendLsInfoCommand(c->connection, path_utf8);
filelist = filelist_new(path);
if (path && path[0] && strcmp(path, "/"))
@@ -784,10 +764,8 @@ mpdclient_filelist_get(mpdclient_t *c, const gchar *path)
g_free(path_utf8);
// If there are only directory entities in the filelist, we sort it
- if (has_dirs_only) {
- D("mpdclient_filelist_get: only dirs; sorting!\n");
+ if (has_dirs_only)
filelist_sort(filelist, compare_filelistentry_dir);
- }
return filelist;
}
@@ -801,7 +779,6 @@ mpdclient_filelist_search_utf8(mpdclient_t *c,
mpdclient_filelist_t *filelist;
mpd_InfoEntity *entity;
- D("mpdclient_filelist_search(%s)\n", filter_utf8);
if (exact_match)
mpd_sendFindCommand(c->connection, table, filter_utf8);
else
@@ -829,7 +806,6 @@ mpdclient_filelist_search(mpdclient_t *c,
mpdclient_filelist_t *filelist;
gchar *filter_utf8 = locale_to_utf8(_filter);
- D("mpdclient_filelist_search(%s)\n", _filter);
filelist = mpdclient_filelist_search_utf8(c, exact_match, table,
filter_utf8);
g_free(filter_utf8);
@@ -882,7 +858,6 @@ mpdclient_get_artists_utf8(mpdclient_t *c)
gchar *str = NULL;
GList *list = NULL;
- D("mpdclient_get_artists()\n");
mpd_sendListCommand(c->connection, MPD_TABLE_ARTIST, NULL);
while ((str = mpd_getNextArtist(c->connection)))
list = g_list_append(list, (gpointer) str);
@@ -899,7 +874,6 @@ mpdclient_get_albums_utf8(mpdclient_t *c, gchar *artist_utf8)
gchar *str = NULL;
GList *list = NULL;
- D("mpdclient_get_albums(%s)\n", artist_utf8);
mpd_sendListCommand(c->connection, MPD_TABLE_ALBUM, artist_utf8);
while ((str = mpd_getNextAlbum(c->connection)))
list = g_list_append(list, (gpointer) str);
diff --git a/src/ncmpc.h b/src/ncmpc.h
index 5d4ca8425..ad6a6e302 100644
--- a/src/ncmpc.h
+++ b/src/ncmpc.h
@@ -5,12 +5,6 @@
#include "config.h"
#endif
-#ifndef NDEBUG
-void D(const char *format, ...);
-#else
-#define D(...)
-#endif
-
/* i18n */
#ifdef HAVE_LOCALE_H
#include <locale.h>
diff --git a/src/options.c b/src/options.c
index dc0475c4d..5b2b47c47 100644
--- a/src/options.c
+++ b/src/options.c
@@ -137,7 +137,6 @@ display_help(void)
static void
handle_option(int c, const char *arg)
{
- D("option callback -%c %s\n", c, arg);
switch (c) {
case '?': /* --help */
display_help();
diff --git a/src/screen.c b/src/screen.c
index 3cfc813d9..d0a3c7467 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -101,7 +101,6 @@ screen_next_mode(mpdclient_t *c, int offset)
else if (next>=max)
next = 0;
- D("current mode: %d:%d next:%d\n", current, max, next);
sf = screen_lookup_name(options.screen_list[next]);
if (sf != NULL)
screen_switch(sf, c);
@@ -365,7 +364,6 @@ screen_exit(void)
void
screen_resize(void)
{
- D("Resize rows %d->%d, cols %d->%d\n",screen.rows,LINES,screen.cols,COLS);
if (COLS<SCREEN_MIN_COLS || LINES<SCREEN_MIN_ROWS) {
screen_exit();
fprintf(stderr, _("Error: Screen to small!\n"));
@@ -527,7 +525,6 @@ screen_paint(mpdclient_t *c)
if (mode_fn->get_title != NULL)
title = mode_fn->get_title(screen.buf, screen.buf_size);
- D("screen_paint(%s)\n", title);
/* paint the title/header window */
if( title )
paint_top_window(title, c, 1);
@@ -642,7 +639,6 @@ screen_get_mouse_event(mpdclient_t *c, unsigned long *bstate, int *row)
/* retreive the mouse event from ncurses */
getmouse(&event);
- D("mouse: id=%d y=%d,x=%d,z=%d\n",event.id,event.y,event.x,event.z);
/* calculate the selected row in the list window */
*row = event.y - screen.top_window.rows;
/* copy button state bits */
diff --git a/src/screen_artist.c b/src/screen_artist.c
index 972de8f45..0593fee3c 100644
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
@@ -307,7 +307,6 @@ browse_callback(mpdclient_t *c, int event, mpd_unused gpointer data)
{
switch(event) {
case BROWSE_DB_UPDATED:
- D("screen_artist.c> browse_callback() [BROWSE_DB_UPDATED]\n");
reload_lists(c);
break;
default:
diff --git a/src/screen_browser.c b/src/screen_browser.c
index b8a1b1ee1..6d2398020 100644
--- a/src/screen_browser.c
+++ b/src/screen_browser.c
@@ -93,7 +93,6 @@ browser_playlist_changed(struct screen_browser *browser, mpdclient_t *c,
if (browser->filelist == NULL)
return;
- D("screen_file.c> playlist_callback() [%d]\n", event);
switch(event) {
case PLAYLIST_EVENT_CLEAR:
clear_highlights(browser->filelist);
diff --git a/src/screen_file.c b/src/screen_file.c
index d12f77ef5..fa741cd27 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -58,7 +58,6 @@ static void
file_changed_callback(mpdclient_t *c, mpd_unused int event,
mpd_unused gpointer data)
{
- D("screen_file.c> filelist_callback() [%d]\n", event);
browser.filelist = mpdclient_filelist_update(c, browser.filelist);
sync_highlights(c, browser.filelist);
list_window_check_selected(browser.lw, filelist_length(browser.filelist));
diff --git a/src/screen_play.c b/src/screen_play.c
index 67de5fa3e..8c564c3fd 100644
--- a/src/screen_play.c
+++ b/src/screen_play.c
@@ -71,7 +71,6 @@ playlist_repaint_if_active(struct mpdclient *c)
static void
playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
{
- D("screen_play.c> playlist_callback() [%d]\n", event);
switch (event) {
case PLAYLIST_EVENT_DELETE:
break;
@@ -121,7 +120,6 @@ center_playing_item(mpdclient_t *c)
/* try to center the song that are playing */
idx = playlist_get_index(c, c->song);
- D("Autocenter song id:%d pos:%d index:%d\n", c->song->id,c->song->pos,idx);
if (idx < 0)
return;
@@ -201,7 +199,6 @@ playlist_save(screen_t *screen, mpdclient_t *c, char *name, char *defaultname)
return -1;
/* send save command to mpd */
- D("Saving playlist as \'%s \'...\n", filename);
if ((error = mpdclient_cmd_save_playlist(c, filename))) {
gint code = GET_ACK_ERROR_CODE(error);
@@ -256,7 +253,6 @@ static void add_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data)
GList **list = tmp->list;
mpdclient_t *c = tmp->c;
- D("pre_completion()...\n");
if (*list == NULL) {
/* create initial list */
*list = gcmp_list_from_path(c, "", NULL, GCMP_TYPE_RFILE);
@@ -277,7 +273,6 @@ static void add_post_completion_cb(GCompletion *gcmp, gchar *line,
mpdclient_t *c = tmp->c;
screen_t *screen = tmp->screen;
- D("post_completion()...\n");
if (g_list_length(items) >= 1)
screen_display_completion_list(screen, items);
diff --git a/src/screen_search.c b/src/screen_search.c
index b7020c043..9d80e15a1 100644
--- a/src/screen_search.c
+++ b/src/screen_search.c
@@ -241,7 +241,6 @@ search_advanced_query(char *query, mpdclient_t *c)
i=0;
while (strv[i]) {
- D("strv[%d] = \"%s\"\n", i, strv[i]);
i++;
}
@@ -258,12 +257,10 @@ search_advanced_query(char *query, mpdclient_t *c)
arg[j] = g_strdup_printf("%s %s", arg[j], strv[i]);
g_free(tmp);
} else {
- D("Bad search tag %s\n", strv[i]);
screen_status_printf(_("Bad search tag %s"), strv[i]);
}
i++;
} else if (strv[i+1] == NULL || strlen(strv[i+1]) == 0) {
- D("No argument for search tag %s\n", strv[i]);
screen_status_printf(_("No argument for search tag %s"), strv[i]);
i++;
// j--;
diff --git a/src/support.c b/src/support.c
index 6cf61137c..bde8d1914 100644
--- a/src/support.c
+++ b/src/support.c
@@ -200,7 +200,6 @@ utf8_to_locale(const char *utf8str)
g_get_charset(&charset);
screen_status_printf(_("Error: Unable to convert characters to %s"),
charset);
- D("utf8_to_locale(): %s\n", error->message);
g_error_free(error);
return g_strdup(utf8str);
}
@@ -229,7 +228,6 @@ locale_to_utf8(const char *localestr)
&error);
if (error) {
screen_status_printf(_("Error: Unable to convert characters to UTF-8"));
- D("locale_to_utf8: %s\n", error->message);
g_error_free(error);
return g_strdup(localestr);
}
diff --git a/src/utils.c b/src/utils.c
index 574b8fa49..5f5940b03 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -19,7 +19,6 @@
*/
#include "utils.h"
-#include "ncmpc.h"
#include "options.h"
#include "support.h"
@@ -81,8 +80,6 @@ gcmp_list_from_path(mpdclient_t *c, const gchar *path, GList *list, gint types)
if ((filelist = mpdclient_filelist_get(c, path)) == NULL)
return list;
- D("retrieved filelist!\n");
-
for (i = 0; i < filelist_length(filelist); ++i) {
struct filelist_entry *entry = filelist_get(filelist, i);
mpd_InfoEntity *entity = entry ? entry->entity : NULL;