With the previous patch to switch to using alternations for variable
expansion, the clone_and_chain set of functions are no longer needed
and no longer need to be passed around. This patch removes them.
(I kept this patch separate to keep the previous patch smaller and more
easily reviewed.)

Signed-off-by: Steve Beattie <[email protected]>
---
 parser/parser_variable.c |   71 +++++++----------------------------------------
 1 file changed, 11 insertions(+), 60 deletions(-)

Index: b/parser/parser_variable.c
===================================================================
--- a/parser/parser_variable.c
+++ b/parser/parser_variable.c
@@ -213,8 +213,7 @@ static int expand_by_alternations(struct
 }
 
 /* doesn't handle variables in options atm */
-static int expand_entry_variables(char **name, void *entry,
-                                 int (dup_and_chain)(void *))
+static int expand_entry_variables(char **name, void *entry)
 {
        struct set_value *valuelist;
        struct var_string *split_var;
@@ -246,52 +245,13 @@ static int expand_entry_variables(char *
        return 0;
 }
 
-int clone_and_chain_cod(void *v)
-{
-       struct cod_entry *entry = (struct cod_entry *) v;
-       struct cod_entry *dup = copy_cod_entry(entry);
-       if (!dup)
-               return 0;
-
-       entry->next = dup;
-
-       return 1;
-}
-
-int clone_and_chain_mnt(void *v)
-{
-       struct mnt_entry *entry = (struct mnt_entry *) v;
-
-       struct mnt_entry *dup = dup_mnt_entry(entry);
-       if (!dup)
-               return 0;
-
-       entry->next = dup;
-
-       return 1;
-}
-
-int clone_and_chain_dbus(void *v)
-{
-       struct dbus_entry *entry = (struct dbus_entry *) v;
-
-       struct dbus_entry *dup = dup_dbus_entry(entry);
-       if (!dup)
-               return 0;
-
-       entry->next = dup;
-
-       return 1;
-}
-
 static int process_variables_in_entries(struct cod_entry *entry_list)
 {
        int error = 0;
        struct cod_entry *entry;
 
        list_for_each(entry_list, entry) {
-               error = expand_entry_variables(&entry->name, entry,
-                                              clone_and_chain_cod);
+               error = expand_entry_variables(&entry->name, entry);
                if (error)
                        return error;
        }
@@ -306,16 +266,13 @@ static int process_variables_in_mnt_entr
        struct mnt_entry *entry;
 
        list_for_each(entry_list, entry) {
-               error = expand_entry_variables(&entry->mnt_point, entry,
-                                              clone_and_chain_mnt);
+               error = expand_entry_variables(&entry->mnt_point, entry);
                if (error)
                        return error;
-               error = expand_entry_variables(&entry->device, entry,
-                                              clone_and_chain_mnt);
+               error = expand_entry_variables(&entry->device, entry);
                if (error)
                        return error;
-               error = expand_entry_variables(&entry->trans, entry,
-                                              clone_and_chain_mnt);
+               error = expand_entry_variables(&entry->trans, entry);
                if (error)
                        return error;
 
@@ -330,28 +287,22 @@ static int process_dbus_variables(struct
        struct dbus_entry *entry;
 
        list_for_each(entry_list, entry) {
-               error = expand_entry_variables(&entry->bus, entry,
-                                              clone_and_chain_dbus);
+               error = expand_entry_variables(&entry->bus, entry);
                if (error)
                        return error;
-               error = expand_entry_variables(&entry->name, entry,
-                                              clone_and_chain_dbus);
+               error = expand_entry_variables(&entry->name, entry);
                if (error)
                        return error;
-               error = expand_entry_variables(&entry->peer_label, entry,
-                                              clone_and_chain_dbus);
+               error = expand_entry_variables(&entry->peer_label, entry);
                if (error)
                        return error;
-               error = expand_entry_variables(&entry->path, entry,
-                                              clone_and_chain_dbus);
+               error = expand_entry_variables(&entry->path, entry);
                if (error)
                        return error;
-               error = expand_entry_variables(&entry->interface, entry,
-                                              clone_and_chain_dbus);
+               error = expand_entry_variables(&entry->interface, entry);
                if (error)
                        return error;
-               error = expand_entry_variables(&entry->member, entry,
-                                              clone_and_chain_dbus);
+               error = expand_entry_variables(&entry->member, entry);
                if (error)
                        return error;
 


-- 
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to