return res;
}
- /* returns 1 if row matches score item, negative otherwise */
- static int add_item_score(const struct osl_row *row, struct mood_item *item, long *score,
- long *score_arg_sum)
-static int mm_no_attributes_set_parser(const char *arg, __a_unused void **ignored)
-{
- if (arg && *arg)
- PARA_WARNING_LOG("ignored junk at eol: %s\n", arg);
- return 1;
-}
-
-static int mm_no_attributes_set_score_function(__a_unused const char *path,
- const struct afs_info *afsi,
- __a_unused const struct afh_info *afhi,
- __a_unused const void *data)
-{
- if (!afsi->attributes)
- return 100;
- return -100;
-}
-
-static int mm_played_rarely_score_function(__a_unused const char *path,
- const struct afs_info *afsi,
- __a_unused const struct afh_info *afhi,
- __a_unused const void *data)
-{
- unsigned num;
- int ret = get_num_admissible_files(&num);
-
- if (ret < 0)
- return 0;
- if (statistics.num_played_sum - num * afsi->num_played
- > int_sqrt(statistics.num_played_qd * num))
- return 100;
- return -100;
-}
-
-static int mm_played_rarely_parser(const char *arg, __a_unused void **ignored)
-{
- if (arg && *arg)
- PARA_WARNING_LOG("ignored junk at eol: %s\n", arg);
- return 1;
-}
-
-static int mm_path_matches_score_function(const char *path,
- __a_unused const struct afs_info *afsi,
- __a_unused const struct afh_info *afhi,
- const void *data)
-{
- if (fnmatch(data, path, 0))
- return -100;
- return 100;
-}
-
-static int mm_path_matches_parser(const char *arg, void **data)
-{
- *data = para_strdup(arg);
- return 1;
-}
-
-static void mm_path_matches_cleanup(void *data)
-{
- free(data);
-}
-
-static int mm_is_set_parser(const char *arg, void **bitnum)
-{
- unsigned char *c = para_malloc(1);
- int ret = get_attribute_bitnum_by_name(arg, c);
-
- if (ret >= 0)
- *bitnum = c;
- else
- free(c);
- return ret;
-}
-
-static int mm_is_set_score_function(__a_unused const char *path,
- __a_unused const struct afs_info *afsi,
- __a_unused const struct afh_info *afhi,
- const void *data)
-{
- const unsigned char *bn = data;
- if (afsi->attributes & (1ULL << *bn))
- return 100;
- return -100;
-}
-
+ /* returns 1 if row matches score item, 0 if not, negative on errors */
+ static int get_item_score(const struct osl_row *row, struct mood_item *item,
+ long *score, long *score_arg_sum)
{
struct afs_info afsi;
struct afh_info afhi;