aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-02-16 21:30:41 -0500
committerSteven Rostedt <rostedt@goodmis.org>2010-02-16 21:30:41 -0500
commit2f9d0898a306b35bed28eb1b455db7a69f058b5b (patch)
tree0cedfdf05425e388fd99e221e61ccac4eb43c2a1
parent070ec4400d7d18e39af7d580351a4132569c0b1b (diff)
parse-events: Add pevent_filter_reset()
Add function pevent_filter_reset() to reset and clear all filters in an event_filter structure. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.h2
-rw-r--r--parse-filter.c20
2 files changed, 19 insertions, 3 deletions
diff --git a/parse-events.h b/parse-events.h
index 8e42947..13b1f3a 100644
--- a/parse-events.h
+++ b/parse-events.h
@@ -589,6 +589,8 @@ int pevent_filter_match(struct event_filter *filter,
589int pevent_event_filtered(struct event_filter *filter, 589int pevent_event_filtered(struct event_filter *filter,
590 int event_id); 590 int event_id);
591 591
592void pevent_filter_reset(struct event_filter *filter);
593
592void pevent_filter_free(struct event_filter *filter); 594void pevent_filter_free(struct event_filter *filter);
593 595
594#endif /* _PARSE_EVENTS_H */ 596#endif /* _PARSE_EVENTS_H */
diff --git a/parse-filter.c b/parse-filter.c
index 98c31dd..1627b96 100644
--- a/parse-filter.c
+++ b/parse-filter.c
@@ -808,16 +808,30 @@ int pevent_filter_remove_event(struct event_filter *filter,
808 return 1; 808 return 1;
809} 809}
810 810
811void pevent_filter_free(struct event_filter *filter) 811/**
812 * pevent_filter_reset - clear all filters in a filter
813 * @filter: the event filter to reset
814 *
815 * Removes all filters from a filter and resets it.
816 */
817void pevent_filter_reset(struct event_filter *filter)
812{ 818{
813 int i; 819 int i;
814 820
815 pevent_unref(filter->pevent);
816
817 for (i = 0; i < filter->filters; i++) 821 for (i = 0; i < filter->filters; i++)
818 free_filter_type(&filter->event_filters[i]); 822 free_filter_type(&filter->event_filters[i]);
819 823
820 free(filter->event_filters); 824 free(filter->event_filters);
825 filter->filters = 0;
826 filter->event_filters = NULL;
827}
828
829void pevent_filter_free(struct event_filter *filter)
830{
831 pevent_unref(filter->pevent);
832
833 pevent_filter_reset(filter);
834
821 free(filter); 835 free(filter);
822} 836}
823 837