Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alex037yang
OpenXG-RAN
Commits
0120c42d
Commit
0120c42d
authored
Nov 25, 2016
by
Cedric Roux
Committed by
Raymond Knopp
Jan 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
T: add mechanisms to free filters
parent
95f992fc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
common/utils/T/tracer/filter/filter.c
common/utils/T/tracer/filter/filter.c
+30
-1
common/utils/T/tracer/filter/filter.h
common/utils/T/tracer/filter/filter.h
+2
-0
No files found.
common/utils/T/tracer/filter/filter.c
View file @
0120c42d
...
...
@@ -13,6 +13,7 @@ struct filter {
}
v
;
int
(
*
eval
)(
struct
filter
*
this
,
event
e
);
void
(
*
free
)(
struct
filter
*
this
);
};
/****************************************************************************/
...
...
@@ -52,7 +53,23 @@ int eval_evarg(struct filter *f, event e)
}
/****************************************************************************/
/* filter construction functions */
/* free memory functions */
/****************************************************************************/
void
free_op2
(
struct
filter
*
f
)
{
free_filter
(
f
->
v
.
op2
.
a
);
free_filter
(
f
->
v
.
op2
.
b
);
free
(
f
);
}
void
free_noop
(
struct
filter
*
f
)
{
free
(
f
);
}
/****************************************************************************/
/* filter construction/destruction functions */
/****************************************************************************/
filter
*
filter_and
(
filter
*
a
,
filter
*
b
)
...
...
@@ -60,6 +77,7 @@ filter *filter_and(filter *a, filter *b)
struct
filter
*
ret
=
calloc
(
1
,
sizeof
(
struct
filter
));
if
(
ret
==
NULL
)
abort
();
ret
->
eval
=
eval_and
;
ret
->
free
=
free_op2
;
ret
->
v
.
op2
.
a
=
a
;
ret
->
v
.
op2
.
b
=
b
;
return
ret
;
...
...
@@ -70,6 +88,7 @@ filter *filter_eq(filter *a, filter *b)
struct
filter
*
ret
=
calloc
(
1
,
sizeof
(
struct
filter
));
if
(
ret
==
NULL
)
abort
();
ret
->
eval
=
eval_eq
;
ret
->
free
=
free_op2
;
ret
->
v
.
op2
.
a
=
a
;
ret
->
v
.
op2
.
b
=
b
;
return
ret
;
...
...
@@ -80,6 +99,7 @@ filter *filter_int(int v)
struct
filter
*
ret
=
calloc
(
1
,
sizeof
(
struct
filter
));
if
(
ret
==
NULL
)
abort
();
ret
->
eval
=
eval_int
;
ret
->
free
=
free_noop
;
ret
->
v
.
v
=
v
;
return
ret
;
}
...
...
@@ -97,6 +117,7 @@ filter *filter_evarg(void *database, char *event_name, char *varname)
f
=
get_format
(
database
,
event_id
);
ret
->
eval
=
eval_evarg
;
ret
->
free
=
free_noop
;
ret
->
v
.
evarg
.
event_type
=
event_id
;
ret
->
v
.
evarg
.
arg_index
=
-
1
;
...
...
@@ -114,6 +135,14 @@ filter *filter_evarg(void *database, char *event_name, char *varname)
return
ret
;
}
void
free_filter
(
filter
*
_f
)
{
struct
filter
*
f
;
if
(
_f
==
NULL
)
return
;
f
=
_f
;
f
->
free
(
f
);
}
/****************************************************************************/
/* eval function */
/****************************************************************************/
...
...
common/utils/T/tracer/filter/filter.h
View file @
0120c42d
...
...
@@ -12,4 +12,6 @@ filter *filter_evarg(void *database, char *event_name, char *varname);
int
filter_eval
(
filter
*
f
,
event
e
);
void
free_filter
(
filter
*
f
);
#endif
/* _FILTER_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment