Skip to content

Instantly share code, notes, and snippets.

@richardlehane
Created February 9, 2011 08:12
Show Gist options
  • Save richardlehane/818134 to your computer and use it in GitHub Desktop.
Save richardlehane/818134 to your computer and use it in GitHub Desktop.
every rule should have a default action
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