Lists: | pgsql-hackers |
---|
From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Randomly placed definition of S_ISDIR() in psql/copy.c |
Date: | 2009-04-25 20:35:21 |
Message-ID: | 25175.1240691721@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Why does psql/copy.c contain this?
#if defined(WIN32) && !defined(S_ISDIR)
#define __S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
#define S_ISDIR(mode) __S_ISTYPE((mode), S_IFDIR)
#endif
Surely a better place for such a thing is src/include/port/win32.h
... where indeed there already is a definition of S_ISDIR().
So I think this is dead code as well as poor style. Any objection to
seeing what happens if we remove it?
regards, tom lane
From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: Randomly placed definition of S_ISDIR() in psql/copy.c |
Date: | 2009-04-26 00:39:07 |
Message-ID: | 20090426003907.GB9166@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
On Sat, Apr 25, 2009 at 04:35:21PM -0400, Tom Lane wrote:
> Why does psql/copy.c contain this?
>
> #if defined(WIN32) && !defined(S_ISDIR)
> #define __S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
> #define S_ISDIR(mode) __S_ISTYPE((mode), S_IFDIR)
> #endif
>
> Surely a better place for such a thing is src/include/port/win32.h
> ... where indeed there already is a definition of S_ISDIR(). So I
> think this is dead code as well as poor style. Any objection to
> seeing what happens if we remove it?
Nope :)
Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com
Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate
From: | Magnus Hagander <magnus(at)hagander(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: Randomly placed definition of S_ISDIR() in psql/copy.c |
Date: | 2009-04-26 06:51:59 |
Message-ID: | 49F4048F.5070709@hagander.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers |
Tom Lane wrote:
> Why does psql/copy.c contain this?
>
> #if defined(WIN32) && !defined(S_ISDIR)
> #define __S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
> #define S_ISDIR(mode) __S_ISTYPE((mode), S_IFDIR)
> #endif
>
> Surely a better place for such a thing is src/include/port/win32.h
> ... where indeed there already is a definition of S_ISDIR().
> So I think this is dead code as well as poor style. Any objection to
> seeing what happens if we remove it?
I believe that code pre-dates the full win32 port, and is from the time
when we did just libpq + psql.
So, +1 on killing it.
//Magnus