[apparmor] [patch 5/5] parser: remove now unused clone_and_chain functions

Seth Arnold seth.arnold at canonical.com
Fri Dec 13 01:25:31 UTC 2013


On Mon, Dec 09, 2013 at 12:37:14PM -0800, Steve Beattie wrote:
> 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 <steve at nxnw.org>

Nice cleanup, this makes for two easier-to-review patches, so thanks for
taking the effort to split them apart. :)

Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks

> ---
>  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;
>  
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20131212/ed59484f/attachment.pgp>


More information about the AppArmor mailing list