Merge branch 'master' into next
authorAndre Noll <maan@systemlinux.org>
Sat, 11 Jul 2009 14:58:40 +0000 (16:58 +0200)
committerAndre Noll <maan@systemlinux.org>
Sat, 11 Jul 2009 14:58:40 +0000 (16:58 +0200)
Conflicts:
mood.c

1  2 
error.h
mood.c

diff --cc error.h
index 79931bf425b6028af61ad63d2735d99dcd2cdf5c,95640da93da67fa3003de00b10be1aff26066b1f..c9031f8201695f49fa95dd9b9047228196d581a8
+++ b/error.h
@@@ -111,8 -150,8 +111,7 @@@ extern const char **para_errlist[]
  
  
  #define MOOD_ERRORS \
 -      PARA_ERROR(MOOD_SYNTAX, "mood syntax error"), \
        PARA_ERROR(NO_MOOD, "no mood available"), \
-       PARA_ERROR(NOT_ADMISSIBLE, "file is not admissible"), \
        PARA_ERROR(DUMMY_ROW, "attempted to access blob dummy object"), \
  
  
diff --cc mood.c
index ae71dab0863c5a8e1c552333bf73f5ae57a78277,24d1de29056812973d33a18a5ed7df378a9f72ad..26d68dc558512380f20f0f45990b268614118381
--- 1/mood.c
--- 2/mood.c
+++ b/mood.c
@@@ -107,9 -164,93 +107,9 @@@ static uint64_t int_sqrt(uint64_t x
        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;