*
* A structure of this type is allocated and initialized at mood open time.
*/
-struct mood {
+struct mood_instance {
/** NULL means that this is the "dummy" mood. */
char *name;
/** Bison's abstract syntax tree, used to determine admissibility. */
* The statistics are adjusted dynamically through this pointer as files are
* added, removed or played.
*/
-static struct mood *current_mood;
+static struct mood_instance *current_mood;
/*
* Find the position of the most-significant set bit.
return res;
}
-static void destroy_mood(struct mood *m)
+static void destroy_mood(struct mood_instance *m)
{
if (!m)
return;
free(m);
}
-static struct mood *alloc_new_mood(const char *name)
+static struct mood_instance *alloc_new_mood(const char *name)
{
- struct mood *m = zalloc(sizeof(struct mood));
+ struct mood_instance *m = zalloc(sizeof(*m));
+
if (name)
m->name = para_strdup(name);
m->stats.normalization_divisor = 1;
return m;
}
-static int init_mood_parser(const char *mood_name, struct mood **m, char **err)
+static int init_mood_parser(const char *mood_name, struct mood_instance **m,
+ char **err)
{
struct osl_object mood_def;
int ret;
struct para_buffer *pb = data;
char *mood_name, *errmsg;
struct osl_object mood_def;
- struct mood *m;
+ struct mood_instance *m;
int ret = mood_get_name_and_def_by_row(mood_row, &mood_name, &mood_def);
if (ret < 0) {
*/
struct admissible_array {
/** Files are admissible wrt. this mood. */
- struct mood *m;
+ struct mood_instance *m;
/** The size of the array */
unsigned size;
/** Pointer to the array of admissible files. */
}
/* sse: seconds since epoch. */
-static char *get_statistics(struct mood *m, int64_t sse)
+static char *get_statistics(struct mood_instance *m, int64_t sse)
{
unsigned n = m->stats.num;
int mean_days, sigma_days;