Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
status: initialize and fix missing declaration
include/status.h | 2 +- src/status.c | 9 ++++++---
diff --git a/include/status.h b/include/status.h index 35d8778bb41925cc29423383a3b0a8100356c0fa..cbdc29d38cef789e3ee0bd4c496ac4668dc9f987 100644 --- a/include/status.h +++ b/include/status.h @@ -2,6 +2,6 @@ #ifndef SEAMUS_STATUS #define SEAMUS_STATUS #include "seamus.h" -int generate_description(struct seamus_status *seamus, struct mpd_status *status); +int generate_description(struct seamus_status *status, struct mpd_song *song); int fetch_current_status(struct seamus_frontend *seamus); #endif diff --git a/src/status.c b/src/status.c index 7f5db31f38ec5d53fb97578f39dfa21bbde4bea6..03ac64aaa12026d51218214ce81fa1dd114ae332 100644 --- a/src/status.c +++ b/src/status.c @@ -2,6 +2,7 @@ #include#include <stdio.h> #include <string.h> #include "seamus.h" +#include "status.h" int fetch_current_status(struct seamus_frontend *s) @@ -17,11 +18,13 @@ return 1; } - // TODO: create or populate this mf + // Initialize status if not already done if (s->status == NULL) { struct seamus_status *s_status = calloc(1, sizeof(struct seamus_status)); - memset(&s_status->description, 0, sizeof(char)); - s->status = s_status; + if (s_status) { + s_status->description = NULL; + s->status = s_status; + } } s->status->repeat = mpd_status_get_repeat(status);