summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9526f18)
raw | patch | inline | side by side (parent: 9526f18)
author | Max Kellermann <max@duempel.org> | |
Thu, 2 Oct 2008 13:44:21 +0000 (15:44 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Thu, 2 Oct 2008 13:44:21 +0000 (15:44 +0200) |
gdb is for debugging. We don't need D() calls littered all over.
13 files changed:
src/conf.c | patch | blob | history | |
src/main.c | patch | blob | history | |
src/mpdclient.c | patch | blob | history | |
src/ncmpc.h | patch | blob | history | |
src/options.c | patch | blob | history | |
src/screen.c | patch | blob | history | |
src/screen_artist.c | patch | blob | history | |
src/screen_browser.c | patch | blob | history | |
src/screen_file.c | patch | blob | history | |
src/screen_play.c | patch | blob | history | |
src/screen_search.c | patch | blob | history | |
src/support.c | patch | blob | history | |
src/utils.c | patch | blob | history |
diff --git a/src/conf.c b/src/conf.c
index 557024dc52967ce726fda045552ea9dab03bb62a..79bbfd3a15effaa1c122a4bde89d0d29e0b0f0b5 100644 (file)
--- a/src/conf.c
+++ b/src/conf.c
if( filename==NULL )
return -1;
- D("Reading configuration file %s\n", filename);
if( (fd=open(filename,O_RDONLY)) <0 )
{
perror(filename);
{
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) )
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 28cce938f97813ad103a7c013e89d2a5a21395b0..f6043d48a9613bd4e8e93b9e897049b57f4d86c2 100644 (file)
--- a/src/main.c
+++ b/src/main.c
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:
static void
catch_sigcont(mpd_unused int sig)
{
- D("catch_sigcont()\n");
#ifdef ENABLE_RAW_MODE
reset_prog_mode(); /* restore tty modes */
refresh();
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);
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 5098226d4727ac51c20f6e6d278783002cf0571a..dbf285e0727bf60f941852102c308ab2984f758a 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.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) {
#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
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);
}
/* 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);
/* 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)) )
#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;
{
mpd_InfoEntity *entity;
- D("mpdclient_playlist_update() [%lld]\n", c->status->playlist);
-
if (MPD_ERROR(c))
return -1;
{
mpd_InfoEntity *entity;
- D("mpdclient_playlist_update_changes() [%lld -> %lld]\n",
- c->status->playlist, c->playlist.id);
-
if (MPD_ERROR(c))
return -1;
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);
}
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);
}
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, "/"))
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;
}
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
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);
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);
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 5d4ca8425e586eec77454cc3f913df096bcf5550..ad6a6e302f80f681e5efdc35a43e20f6885b3cd8 100644 (file)
--- a/src/ncmpc.h
+++ b/src/ncmpc.h
#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 dc0475c4d1be040e61bbd896f70190dcb4ca573f..5b2b47c478fc93be5bf3d9c905b264eb4b8c4fc5 100644 (file)
--- a/src/options.c
+++ b/src/options.c
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 3cfc813d9ce298061cb9f5eec3eac67fa7b07804..d0a3c74673bad1896723267b2a98a1a20b5ef921 100644 (file)
--- a/src/screen.c
+++ b/src/screen.c
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);
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"));
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);
/* 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 972de8f455b0af121a17eabc1bdbf737ab91b458..0593fee3c45369e0ceb0aff6bb04aa41616f9dd2 100644 (file)
--- a/src/screen_artist.c
+++ b/src/screen_artist.c
{
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 b8a1b1ee1e552d908135f917a74480d170c5bbff..6d23980208061a1f5d9bd48ec5f764d28a6c17eb 100644 (file)
--- a/src/screen_browser.c
+++ b/src/screen_browser.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 d12f77ef52b1ca5e57b5d66e463105a2048c4d76..fa741cd275b39997f099ed641ace302e03f12ea9 100644 (file)
--- a/src/screen_file.c
+++ b/src/screen_file.c
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 67de5fa3e62d3d6ce73ec045b6613668a7351e3e..8c564c3fd56c701bf5d2f0a57c7ff7f27a93d6a2 100644 (file)
--- a/src/screen_play.c
+++ b/src/screen_play.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;
/* 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;
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);
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);
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 b7020c04397ecae1dde586ff35bfbff3bfce9b4f..9d80e15a1d7250540260f84b907fc5690fcf4f96 100644 (file)
--- a/src/screen_search.c
+++ b/src/screen_search.c
i=0;
while (strv[i]) {
- D("strv[%d] = \"%s\"\n", i, strv[i]);
i++;
}
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 6cf61137c2534c09c184a208fa1163e9beff7f9a..bde8d1914b012fe7cb4a5cf35bb5d26679832b05 100644 (file)
--- a/src/support.c
+++ b/src/support.c
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);
}
&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 574b8fa49d9eba73d3f19cb5ea393160b1ffb283..5f5940b032027bc18382bc9f7ab8ab4a11f57ced 100644 (file)
--- a/src/utils.c
+++ b/src/utils.c
*/
#include "utils.h"
-#include "ncmpc.h"
#include "options.h"
#include "support.h"
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;