diff options
author | Max Kellermann <max@duempel.org> | 2008-09-15 12:27:29 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-15 12:27:29 +0200 |
commit | 6e81a1b3e08a423c6f4c6976aecae915bd1a3f0b (patch) | |
tree | c8f9ebb406e85fcb712e2dae8e5c80a2acaa8421 /src/src_lyrics.c | |
parent | 08c055113f2eacd42fde57b952b548ca45e29eb2 (diff) | |
download | mpd-6e81a1b3e08a423c6f4c6976aecae915bd1a3f0b.tar.gz mpd-6e81a1b3e08a423c6f4c6976aecae915bd1a3f0b.tar.xz mpd-6e81a1b3e08a423c6f4c6976aecae915bd1a3f0b.zip |
fixed mixed declaration + code
Although they are allowedd in C99, try to avoid them. Move variable
declarations to the top of the current scope.
Diffstat (limited to '')
-rw-r--r-- | src/src_lyrics.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/src_lyrics.c b/src/src_lyrics.c index 4d41aea37..448c301ad 100644 --- a/src/src_lyrics.c +++ b/src/src_lyrics.c @@ -28,10 +28,12 @@ int get_text_line(formed_text *text, int num, char *dest, int len) { + int linelen; + memset(dest, '\0', len*sizeof(char)); if (num >= text->lines->len - 1) return -1; - int linelen; + if (num == 0) { linelen = g_array_index(text->lines, int, num); memcpy(dest, text->text->str, linelen*sizeof(char)); @@ -128,9 +130,10 @@ void src_lyr_stack_init(void) int src_lyr_init(void) { + int i = 0; + src_lyr_stack_init (); - int i = 0; while (g_array_index (src_lyr_stack, src_lyr*, i) != NULL) { src_lyr *i_stack; i_stack = g_array_index (src_lyr_stack, src_lyr*, i); @@ -150,12 +153,14 @@ int get_lyr_by_src (int priority, char *artist, char *title) static int src_lyr_load_plugin_file(const char *file) { GString *path; + src_lyr *new_src; + src_lyr_plugin_register register_func; + path = g_string_new (PLUGIN_DIR_SYSTEM); g_string_append (path, "/"); g_string_append (path, file); - src_lyr_plugin_register register_func; - src_lyr *new_src = malloc (sizeof (src_lyr)); + new_src = malloc(sizeof(src_lyr)); new_src->module = g_module_open (path->str, G_MODULE_BIND_LAZY); if (!g_module_symbol (new_src->module, "register_me", (gpointer*) ®ister_func)) return -1; @@ -178,13 +183,13 @@ static void src_lyr_plugins_load_from_dir(GDir *plugin_dir) static int src_lyr_plugins_load(void) { GDir *plugin_dir; + GString *user_dir_path; plugin_dir = g_dir_open (PLUGIN_DIR_SYSTEM, 0, NULL); if (plugin_dir == NULL) return -1; src_lyr_plugins_load_from_dir (plugin_dir); - GString *user_dir_path; user_dir_path = g_string_new (g_get_home_dir()); g_string_append (user_dir_path, PLUGIN_DIR_USER); |