From d616d97a3ef8a1202933ba2000b363d0dcb69d3d Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 8 May 2002 06:36:28 +0000 Subject: Changed to return a GList *, a list of the names of the rules affected by 2002-05-08 Not Zed * rule-context.c (rule_context_delete_uri): Changed to return a GList *, a list of the names of the rules affected by the delete, fixed all implementors. (rule_context_rename_uri): Similarly for delete_uri, for api consistency. (rule_context_free_uri_list): Util function to free the return from above. * filter-context.c (filter_delete_uri): Actually implement it, fix for #18826, and some related bugs. svn path=/trunk/; revision=16718 --- filter/rule-context.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'filter/rule-context.c') diff --git a/filter/rule-context.c b/filter/rule-context.c index d11e4ec722..18939a0041 100644 --- a/filter/rule-context.c +++ b/filter/rule-context.c @@ -38,8 +38,8 @@ static int load(RuleContext * f, const char *system, const char *user); static int save(RuleContext * f, const char *user); -static int rename_uri(RuleContext *f, const char *olduri, const char *newuri, GCompareFunc cmp); -static int delete_uri(RuleContext *f, const char *uri, GCompareFunc cmp); +static GList *rename_uri(RuleContext *f, const char *olduri, const char *newuri, GCompareFunc cmp); +static GList *delete_uri(RuleContext *f, const char *uri, GCompareFunc cmp); static void rule_context_class_init(RuleContextClass * class); static void rule_context_init(RuleContext * gspaper); @@ -652,28 +652,43 @@ rule_context_find_rank_rule (RuleContext *f, int rank, const char *source) return NULL; } -static int +static GList * delete_uri(RuleContext *f, const char *uri, GCompareFunc cmp) { - return 0; + return NULL; } -int +GList * rule_context_delete_uri(RuleContext *f, const char *uri, GCompareFunc cmp) { return ((RuleContextClass *) ((GtkObject *) f)->klass)->delete_uri(f, uri, cmp); } -static int +static GList * rename_uri(RuleContext *f, const char *olduri, const char *newuri, GCompareFunc cmp) { - return 0; + return NULL; } -int +GList * rule_context_rename_uri(RuleContext *f, const char *olduri, const char *newuri, GCompareFunc cmp) { return ((RuleContextClass *) ((GtkObject *) f)->klass)->rename_uri (f, olduri, newuri, cmp); } +void +rule_context_free_uri_list(RuleContext *f, GList *uris) +{ + GList *l = uris, *n; + + /* TODO: should be virtual */ + + while (l) { + n = l->next; + g_free(l->data); + g_list_free_1(l); + l = n; + } +} + -- cgit