projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix link to gitweb on the main page.
[paraslash.git]
/
mood.c
diff --git
a/mood.c
b/mood.c
index 77b4a7361554fa05ca36f7685114c2bd1b7ba68c..9ddfc58853574a09d4d0073b052df14bced7054a 100644
(file)
--- a/
mood.c
+++ b/
mood.c
@@
-203,7
+203,7
@@
static int mm_played_rarely_parser(const char *arg, __a_unused void **ignored)
return 1;
}
return 1;
}
-static int mm_
name_like
_score_function(const char *path,
+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)
__a_unused const struct afs_info *afsi,
__a_unused const struct afh_info *afhi,
const void *data)
@@
-213,13
+213,13
@@
static int mm_name_like_score_function(const char *path,
return 100;
}
return 100;
}
-static int mm_
name_like
_parser(const char *arg, void **data)
+static int mm_
path_matches
_parser(const char *arg, void **data)
{
*data = para_strdup(arg);
return 1;
}
{
*data = para_strdup(arg);
return 1;
}
-static void mm_
name_like
_cleanup(void *data)
+static void mm_
path_matches
_cleanup(void *data)
{
free(data);
}
{
free(data);
}
@@
-320,7
+320,7
@@
static const struct mood_method mood_methods[] = {
{DEFINE_MOOD_METHOD(no_attributes_set)},
{DEFINE_MOOD_METHOD(played_rarely)},
{DEFINE_MOOD_METHOD(is_set)},
{DEFINE_MOOD_METHOD(no_attributes_set)},
{DEFINE_MOOD_METHOD(played_rarely)},
{DEFINE_MOOD_METHOD(is_set)},
- {DEFINE_MOOD_METHOD_WITH_CLEANUP(
name_like
)},
+ {DEFINE_MOOD_METHOD_WITH_CLEANUP(
path_matches
)},
{.parser = NULL}
};
{.parser = NULL}
};
@@
-372,8
+372,11
@@
enum mood_line_type {
ML_SCORE
};
ML_SCORE
};
+/** Data passed to the parser of a mood line. */
struct mood_line_parser_data {
struct mood_line_parser_data {
+ /** The mood this mood line belongs to. */
struct mood *m;
struct mood *m;
+ /** The line number in the mood definition. */
unsigned line_num;
};
unsigned line_num;
};
@@
-419,11
+422,13
@@
static int parse_mood_line(char *mood_line, void *data)
w++;
if (!*w)
goto out;
w++;
if (!*w)
goto out;
- if (!strcmp(*w, "with")) {
- w++;
- if (!*w)
- goto out;
- }
+ if (strcmp(*w, "with"))
+ goto check_for_if;
+ w++;
+ if (!*w)
+ goto out;
+ if (strcmp(*w, "score"))
+ goto out;
}
if (mlt == ML_SCORE || !strcmp(*w, "score")) {
ret = -E_MOOD_SYNTAX;
}
if (mlt == ML_SCORE || !strcmp(*w, "score")) {
ret = -E_MOOD_SYNTAX;
@@
-446,6
+451,7
@@
static int parse_mood_line(char *mood_line, void *data)
w++;
if (!*w)
goto out;
w++;
if (!*w)
goto out;
+check_for_if:
if (!strcmp(*w, "if")) {
ret = -E_MOOD_SYNTAX;
w++;
if (!strcmp(*w, "if")) {
ret = -E_MOOD_SYNTAX;
w++;