aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-link.c
diff options
context:
space:
mode:
Diffstat (limited to 'libctf/ctf-link.c')
-rw-r--r--libctf/ctf-link.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index 7b0ac38..886106c 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -528,6 +528,16 @@ ctf_link_one_type (ctf_id_t type, int isroot _libctf_unused_, void *arg_)
return 0; /* As above: do not lose types. */
}
+/* Set a function which is used to filter out unwanted variables from the link. */
+int
+ctf_link_set_variable_filter (ctf_file_t *fp, ctf_link_variable_filter_f *filter,
+ void *arg)
+{
+ fp->ctf_link_variable_filter = filter;
+ fp->ctf_link_variable_filter_arg = arg;
+ return 0;
+}
+
/* Check if we can safely add a variable with the given type to this container. */
static int
@@ -564,6 +574,15 @@ ctf_link_one_variable (const char *name, ctf_id_t type, void *arg_)
ctf_file_t *check_fp;
ctf_dvdef_t *dvd;
+ /* See if this variable is filtered out. */
+
+ if (arg->out_fp->ctf_link_variable_filter)
+ {
+ void *farg = arg->out_fp->ctf_link_variable_filter_arg;
+ if (arg->out_fp->ctf_link_variable_filter (arg->in_fp, name, type, farg))
+ return 0;
+ }
+
/* In unconflicted link mode, if this type is mapped to a type in the parent
container, we want to try to add to that first: if it reports a duplicate,
or if the type is in a child already, add straight to the child. */