struct list_head score_list;
};
+/*
+ * If current_mood is NULL then no mood is currently open. If
+ * current_mood->name is NULL, the dummy mood is currently open
+ */
static struct mood *current_mood;
/**
static struct mood *alloc_new_mood(const char *name)
{
struct mood *m = para_calloc(sizeof(struct mood));
- m->name = para_strdup(name);
+ if (name)
+ m->name = para_strdup(name);
INIT_LIST_HEAD(&m->accept_list);
INIT_LIST_HEAD(&m->deny_list);
INIT_LIST_HEAD(&m->score_list);
return ret;
close_current_mood();
current_mood = m;
- } else {
+ } else { /* load dummy mood */
close_current_mood();
- current_mood = alloc_new_mood("dummy");
+ current_mood = alloc_new_mood(NULL);
}
aa.m = current_mood;
PARA_NOTICE_LOG("computing statistics of admissible files\n");
if (ret < 0)
goto out;
}
- PARA_NOTICE_LOG("loaded mood %s\n", current_mood->name);
+ PARA_NOTICE_LOG("loaded mood %s\n", mood_name? mood_name : "(dummy)");
ret = statistics.num;
out:
free(aa.array);