Unix Technical Forum

cleanup: remove MemSet() casts

This is a discussion on cleanup: remove MemSet() casts within the Pgsql Patches forums, part of the PostgreSQL category; --> There were various locations in the code that were casting the first argument to MemSet() or occasionally memset() to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 12:18 AM
Neil Conway
 
Posts: n/a
Default cleanup: remove MemSet() casts

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


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 12:18 AM
Neil Conway
 
Posts: n/a
Default Re: cleanup: remove MemSet() casts

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


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-18-2008, 12:18 AM
Neil Conway
 
Posts: n/a
Default Re: cleanup: remove MemSet() casts

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

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:25 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com