Re: cleanup: remove MemSet() casts

Lists: pgsql-patches
From: Neil Conway <neilc(at)samurai(dot)com>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: cleanup: remove MemSet() casts
Date: 2005-05-10 06:14:16
Message-ID: 42805138.5010805@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

There were various locations in the code that were casting the first
argument to MemSet() or occasionally memset() to a char *. This is not
necessary, per C89: memset's first argument is a void * to begin with,
and there is an implicit conversion between void * and any other pointer
type.

I also noticed a bit of unclear / inconsistent code in MemSet() itself:
it's not obvious whether unary * or postfix ++ has higher precedence
(the latter does), so I added some parentheses to make this clear.

Barring any objections, I'll apply this to HEAD tomorrow.

-Neil

Attachment Content-Type Size
memset_char_ptr_cast_cleanup-2.patch text/x-patch 10.3 KB

From: Neil Conway <neilc(at)samurai(dot)com>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: cleanup: remove MemSet() casts
Date: 2005-05-10 06:49:28
Message-ID: 42805978.8060802@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Neil Conway wrote:
> I also noticed a bit of unclear / inconsistent code in MemSet() itself:
> it's not obvious whether unary * or postfix ++ has higher precedence
> (the latter does), so I added some parentheses to make this clear.

Okay, apparently I'm the only person who doesn't like code like this :)
Attached is a revised patch that doesn't make this change.

-Neil

Attachment Content-Type Size
memset_char_ptr_cast_cleanup-3.patch text/x-patch 10.3 KB

From: Neil Conway <neilc(at)samurai(dot)com>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: cleanup: remove MemSet() casts
Date: 2005-05-11 01:27:16
Message-ID: 42815F74.6020906@samurai.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Neil Conway wrote:
> Okay, apparently I'm the only person who doesn't like code like this :)
> Attached is a revised patch that doesn't make this change.

Applied.

-Neil