All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 4/4] block: Drop some superfluous casts from void *
Date: Mon, 18 Aug 2014 18:58:04 +0200	[thread overview]
Message-ID: <53F2309C.7020002@redhat.com> (raw)
In-Reply-To: <1408378243-19713-5-git-send-email-armbru@redhat.com>

On 18.08.2014 18:10, Markus Armbruster wrote:
> They clutter the code.  Unfortunately, I can't figure out how to make
> Coccinelle drop all of them, so I have to settle for common special
> cases:
>
>      @@
>      type T;
>      T *pt;
>      void *pv;
>      @@
>      - pt = (T *)pv;
>      + pt = pv;
>      @@
>      type T;
>      @@
>      - (T *)
>        (\(g_malloc\|g_malloc0\|g_realloc\|g_new\|g_new0\|g_renew\|
> 	 g_try_malloc\|g_try_malloc0\|g_try_realloc\|
> 	 g_try_new\|g_try_new0\|g_try_renew\)(...))
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   block/vhdx-log.c    | 2 +-
>   block/vvfat.c       | 8 ++++----
>   hw/ide/microdrive.c | 2 +-
>   3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/block/vhdx-log.c b/block/vhdx-log.c
> index eb5c7a0..4267e60 100644
> --- a/block/vhdx-log.c
> +++ b/block/vhdx-log.c
> @@ -923,7 +923,7 @@ static int vhdx_log_write(BlockDriverState *bs, BDRVVHDXState *s,
>       buffer = qemu_blockalign(bs, total_length);
>       memcpy(buffer, &new_hdr, sizeof(new_hdr));
>   
> -    new_desc = (VHDXLogDescriptor *) (buffer + sizeof(new_hdr));
> +    new_desc = (buffer + sizeof(new_hdr));
>       data_sector = buffer + (desc_sectors * VHDX_LOG_SECTOR_SIZE);
>       data_tmp = data;

You could drop the parantheses here. Also, I still don't like void 
pointer arithmetic, but well... ;-)

Reviewed-by: Max Reitz <mreitz@redhat.com>

  reply	other threads:[~2014-08-18 16:58 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 16:10 [Qemu-devel] [PATCH v2 0/4] block: Use g_new() & friends more Markus Armbruster
2014-08-18 16:10 ` [Qemu-devel] [PATCH v2 1/4] block: Use g_new() & friends where that makes obvious sense Markus Armbruster
2014-08-18 16:35   ` Max Reitz
2014-08-18 19:43   ` Jeff Cody
2014-08-18 16:10 ` [Qemu-devel] [PATCH v2 2/4] block: Use g_new() & friends to avoid multiplying sizes Markus Armbruster
2014-08-18 16:48   ` Max Reitz
2014-08-18 19:57   ` Jeff Cody
2014-08-18 16:10 ` [Qemu-devel] [PATCH v2 3/4] qemu-io-cmds: g_renew() can't fail, bury dead error handling Markus Armbruster
2014-08-18 16:50   ` Max Reitz
2014-08-18 19:59   ` Jeff Cody
2014-08-18 16:10 ` [Qemu-devel] [PATCH v2 4/4] block: Drop some superfluous casts from void * Markus Armbruster
2014-08-18 16:58   ` Max Reitz [this message]
2014-08-19  7:10     ` Markus Armbruster
2014-08-18 20:06   ` Jeff Cody
2014-08-19  7:10     ` Markus Armbruster
2014-08-19  8:33       ` Markus Armbruster

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=53F2309C.7020002@redhat.com \
    --to=mreitz@redhat.com \
    --cc=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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.