Created
February 9, 2011 08:12
-
-
Save richardlehane/818134 to your computer and use it in GitHub Desktop.
every rule should have a default action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MatchRule register_rule (MatchRule *rule, int type, gchar *name, (void *action)(void)) | |
{ | |
MatchRule new_rule; | |
MatchRule *next = rule; | |
new_rule.type = type; | |
new_rule->name = name; | |
new_rule->action = action; | |
new_rule->subrule = NULL; | |
new_rule->fails = NULL; | |
while (next) { | |
rule = rule->fails; | |
next = rule->fails; | |
} | |
if (rule) | |
rule->fails = new_rule; | |
return new_rule; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment