Mercurial > audlegacy
changeset 4403:848a905816f5
Remove formatter functions, they are only used in song_change plugin.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 31 Mar 2008 06:04:21 +0300 |
parents | fdad21c61390 |
children | 7513318719a7 |
files | src/audacious/Makefile src/audacious/formatter.c src/audacious/formatter.h src/audacious/plugin.h src/audacious/pluginenum.c |
diffstat | 5 files changed, 0 insertions(+), 195 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/Makefile Mon Mar 31 08:37:38 2008 +0300 +++ b/src/audacious/Makefile Mon Mar 31 06:04:21 2008 +0300 @@ -17,7 +17,6 @@ eventqueue.c \ fft.c \ flow.c \ - formatter.c \ general.c \ hints.c \ hook.c \ @@ -96,7 +95,6 @@ dbus-service.h \ eventqueue.h \ flow.h \ - formatter.h \ rcfile.h \ i18n.h \ input.h \
--- a/src/audacious/formatter.c Mon Mar 31 08:37:38 2008 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* Audacious - * Copyright (C) 2005-2007 Audacious team - * - * XMMS - Cross-platform multimedia player - * Copyright (C) 1998-2003 Peter Alm, Mikael Alm, Olle Hallnas, - * Thomas Nilsson and 4Front Technologies - * Copyright (C) 1999-2003 Haavard Kvaalen - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; under version 3 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses>. - * - * The Audacious team does not consider modular code linking to - * Audacious or using our public API to be a derived work. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include <glib.h> -#include <string.h> -#include "formatter.h" - -/** - * formatter_new: - * - * Factory for #Formatter objects. - * - * Return value: A #Formatter object. - **/ -Formatter * -formatter_new(void) -{ - Formatter *formatter = g_slice_new0(Formatter); - - formatter_associate(formatter, '%', "%"); - return formatter; -} - -/** - * formatter_destroy: - * @formatter: A #Formatter object to destroy. - * - * Destroys #Formatter objects. - **/ -void -formatter_destroy(Formatter * formatter) -{ - int i; - - for (i = 0; i < 256; i++) - if (formatter->values[i]) - g_free(formatter->values[i]); - - g_slice_free(Formatter, formatter); -} - -/** - * formatter_associate: - * @formatter: A #Formatter object to use. - * @id: The character to use for replacement. - * @value: The value to replace with. - * - * Adds a id->replacement set to the formatter's stack. - **/ -void -formatter_associate(Formatter * formatter, guchar id, char *value) -{ - formatter_dissociate(formatter, id); - formatter->values[id] = g_strdup(value); -} - -/** - * formatter_dissociate: - * @formatter: A #Formatter object to use. - * @id: The id to remove the id->replacement mapping for. - * - * Removes an id->replacement mapping from the formatter's stack. - **/ -void -formatter_dissociate(Formatter * formatter, guchar id) -{ - if (formatter->values[id]) - g_free(formatter->values[id]); - formatter->values[id] = 0; -} - -/** - * formatter_format: - * @formatter: A #Formatter object to use. - * @format: A string to format. - * - * Performs id->replacement substitution on a string. - * - * Returns: The formatted string. - **/ -gchar * -formatter_format(Formatter * formatter, char *format) -{ - char *p, *q, *buffer; - int len; - - for (p = format, len = 0; *p; p++) - if (*p == '%') { - if (formatter->values[(int) *++p]) - len += strlen(formatter->values[(int) *p]); - else if (!*p) { - len += 1; - p--; - } - else - len += 2; - } - else - len++; - buffer = g_malloc(len + 1); - for (p = format, q = buffer; *p; p++) - if (*p == '%') { - if (formatter->values[(int) *++p]) { - g_strlcpy(q, formatter->values[(int) *p], len - 1); - q += strlen(q); - } - else { - *q++ = '%'; - if (*p != '\0') - *q++ = *p; - else - p--; - } - } - else - *q++ = *p; - *q = 0; - return buffer; -}
--- a/src/audacious/formatter.h Mon Mar 31 08:37:38 2008 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -#ifndef XMMS_FORMATTER_H -#define XMMS_FORMATTER_H - -#include <glib.h> - -/** - * Formatter: - * @values: The stack of values used for replacement. - * - * Formatter objects contain id->replacement mapping tables. - **/ -typedef struct { - gchar *values[256]; -} Formatter; - - -G_BEGIN_DECLS - -Formatter *formatter_new(void); -void formatter_destroy(Formatter * formatter); -void formatter_associate(Formatter * formatter, guchar id, - gchar * value); -void formatter_dissociate(Formatter * formatter, guchar id); -gchar *formatter_format(Formatter * formatter, gchar * format); - -G_END_DECLS - -#endif
--- a/src/audacious/plugin.h Mon Mar 31 08:37:38 2008 +0300 +++ b/src/audacious/plugin.h Mon Mar 31 06:04:21 2008 +0300 @@ -157,7 +157,6 @@ #include "audacious/mime.h" #include "audacious/custom_uri.h" #include "audacious/hook.h" -#include "audacious/formatter.h" #include "audacious/flow.h" #define PLUGIN_COMMON_FIELDS \ @@ -593,14 +592,6 @@ gint (*drct_pq_get_position)( gint pos ); gint (*drct_pq_get_queue_position)( gint pos ); - /* Formatter API */ - Formatter *(*formatter_new)(void); - void (*formatter_destroy)(Formatter * formatter); - void (*formatter_associate)(Formatter * formatter, guchar id, - gchar * value); - void (*formatter_dissociate)(Formatter * formatter, guchar id); - gchar *(*formatter_format)(Formatter * formatter, gchar * format); - gint (*prefswin_page_new)(GtkWidget *container, gchar *name, gchar *imgurl); void (*prefswin_page_destroy)(GtkWidget *container); @@ -954,12 +945,6 @@ #define audacious_drct_pq_get_position _audvt->drct_pq_get_position #define audacious_drct_pq_get_queue_position _audvt->drct_pq_get_queue_position -#define aud_formatter_new _audvt->formatter_new -#define aud_formatter_destroy _audvt->formatter_destroy -#define aud_formatter_associate _audvt->formatter_associate -#define aud_formatter_dissociate _audvt->formatter_dissociate -#define aud_formatter_format _audvt->formatter_format - #define aud_prefswin_page_new _audvt->prefswin_page_new #define aud_prefswin_page_destroy _audvt->prefswin_page_destroy
--- a/src/audacious/pluginenum.c Mon Mar 31 08:37:38 2008 +0300 +++ b/src/audacious/pluginenum.c Mon Mar 31 06:04:21 2008 +0300 @@ -351,12 +351,6 @@ .drct_pq_get_position = drct_pq_get_position, .drct_pq_get_queue_position = drct_pq_get_queue_position, - .formatter_new = formatter_new, - .formatter_destroy = formatter_destroy, - .formatter_associate = formatter_associate, - .formatter_dissociate = formatter_dissociate, - .formatter_format = formatter_format, - .prefswin_page_new = prefswin_page_new, .prefswin_page_destroy = prefswin_page_destroy,