All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Joo Aun Saw <jasaw@dius.com.au>, linux-iio@vger.kernel.org
Subject: Re: [PATCH 2/2] tools: iio: remove unnecessary double pointer
Date: Sat, 8 Aug 2015 19:54:44 +0100	[thread overview]
Message-ID: <55C65074.8090406@kernel.org> (raw)
In-Reply-To: <1437751409-28837-3-git-send-email-jasaw@dius.com.au>

On 24/07/15 16:23, Joo Aun Saw wrote:
> From: Joo Aun Saw <jasaw@dius.com.au>
> 
> Remove unnecessary double pointer from channel sorting function.
> 
> Signed-off-by: Joo Aun Saw <jasaw@dius.com.au>
Applied to the togreg branch of iio.git

Thanks,

Jonathan
> ---
>  tools/iio/iio_utils.c | 12 ++++++------
>  tools/iio/iio_utils.h |  2 +-
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
> index 8731905..5b0beea 100644
> --- a/tools/iio/iio_utils.c
> +++ b/tools/iio/iio_utils.c
> @@ -289,17 +289,17 @@ error_free_builtname:
>   * @cnt: the amount of array elements
>   **/
>  
> -void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt)
> +void bsort_channel_array_by_index(struct iio_channel_info *ci_array, int cnt)
>  {
>  	struct iio_channel_info temp;
>  	int x, y;
>  
>  	for (x = 0; x < cnt; x++)
>  		for (y = 0; y < (cnt - 1); y++)
> -			if ((*ci_array)[y].index > (*ci_array)[y + 1].index) {
> -				temp = (*ci_array)[y + 1];
> -				(*ci_array)[y + 1] = (*ci_array)[y];
> -				(*ci_array)[y] = temp;
> +			if (ci_array[y].index > ci_array[y + 1].index) {
> +				temp = ci_array[y + 1];
> +				ci_array[y + 1] = ci_array[y];
> +				ci_array[y] = temp;
>  			}
>  }
>  
> @@ -519,7 +519,7 @@ int build_channel_array(const char *device_dir,
>  
>  	free(scan_el_dir);
>  	/* reorder so that the array is in index order */
> -	bsort_channel_array_by_index(ci_array, *counter);
> +	bsort_channel_array_by_index(*ci_array, *counter);
>  
>  	return 0;
>  
> diff --git a/tools/iio/iio_utils.h b/tools/iio/iio_utils.h
> index f30a109..e3503bf 100644
> --- a/tools/iio/iio_utils.h
> +++ b/tools/iio/iio_utils.h
> @@ -60,7 +60,7 @@ int iioutils_get_type(unsigned *is_signed, unsigned *bytes, unsigned *bits_used,
>  int iioutils_get_param_float(float *output, const char *param_name,
>  			     const char *device_dir, const char *name,
>  			     const char *generic_name);
> -void bsort_channel_array_by_index(struct iio_channel_info **ci_array, int cnt);
> +void bsort_channel_array_by_index(struct iio_channel_info *ci_array, int cnt);
>  int build_channel_array(const char *device_dir,
>  			struct iio_channel_info **ci_array, int *counter);
>  int find_type_by_name(const char *name, const char *type);
> 


      parent reply	other threads:[~2015-08-08 18:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 15:23 [PATCH 0/2] tools: iio: clean up ci_array pointer Joo Aun Saw
2015-07-24 15:23 ` [PATCH 1/2] tools: iio: Set caller's ci_array pointer to NULL after free Joo Aun Saw
2015-07-24 19:10   ` Hartmut Knaack
2015-07-25  5:00     ` Joo Aun Saw
2015-07-25  5:12     ` Joo Aun Saw
2015-08-08 18:53       ` Jonathan Cameron
2015-07-24 15:23 ` [PATCH 2/2] tools: iio: remove unnecessary double pointer Joo Aun Saw
2015-07-24 19:19   ` Hartmut Knaack
2015-07-25  5:25     ` Joo Aun Saw
2015-08-08 18:54   ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55C65074.8090406@kernel.org \
    --to=jic23@kernel.org \
    --cc=jasaw@dius.com.au \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.