Re: fix ZIC dependency on postgres.h

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: fix ZIC dependency on postgres.h
Date: 2007-10-26 13:32:41
Message-ID: 14720.1193405561@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM> writes:
> I attached patch which removes dependency on postgres.h during ZIC
> compilation.

I consider it poor style to have an include file (particularly one
that's fairly widely used, like pgtime.h) including any of postgres.h
postgres_fe.h or c.h. That's pre-empting a decision that needs to be
made on a per-c-file basis. So I fixed it as attached, instead.

regards, tom lane

Index: ialloc.c
===================================================================
RCS file: /cvsroot/pgsql/src/timezone/ialloc.c,v
retrieving revision 1.8
diff -c -r1.8 ialloc.c
*** ialloc.c 26 Jan 2007 17:45:42 -0000 1.8
--- ialloc.c 26 Oct 2007 13:28:46 -0000
***************
*** 6,12 ****
* $PostgreSQL: pgsql/src/timezone/ialloc.c,v 1.8 2007/01/26 17:45:42 neilc Exp $
*/

! #include "postgres.h"

#include "private.h"

--- 6,12 ----
* $PostgreSQL: pgsql/src/timezone/ialloc.c,v 1.8 2007/01/26 17:45:42 neilc Exp $
*/

! #include "postgres_fe.h"

#include "private.h"

Index: localtime.c
===================================================================
RCS file: /cvsroot/pgsql/src/timezone/localtime.c,v
retrieving revision 1.17
diff -c -r1.17 localtime.c
*** localtime.c 4 Aug 2007 19:29:25 -0000 1.17
--- localtime.c 26 Oct 2007 13:28:46 -0000
***************
*** 12,18 ****
* (guy(at)auspex(dot)com).
*/

! #include "postgres.h"

#include <fcntl.h>

--- 12,19 ----
* (guy(at)auspex(dot)com).
*/

! /* this file needs to build in both frontend and backend contexts */
! #include "c.h"

#include <fcntl.h>

Index: scheck.c
===================================================================
RCS file: /cvsroot/pgsql/src/timezone/scheck.c,v
retrieving revision 1.7
diff -c -r1.7 scheck.c
*** scheck.c 15 Oct 2005 02:49:51 -0000 1.7
--- scheck.c 26 Oct 2007 13:28:46 -0000
***************
*** 6,12 ****
* $PostgreSQL: pgsql/src/timezone/scheck.c,v 1.7 2005/10/15 02:49:51 momjian Exp $
*/

! #include "postgres.h"

#include "private.h"

--- 6,12 ----
* $PostgreSQL: pgsql/src/timezone/scheck.c,v 1.7 2005/10/15 02:49:51 momjian Exp $
*/

! #include "postgres_fe.h"

#include "private.h"

Index: zic.c
===================================================================
RCS file: /cvsroot/pgsql/src/timezone/zic.c,v
retrieving revision 1.21
diff -c -r1.21 zic.c
*** zic.c 1 Feb 2007 19:10:30 -0000 1.21
--- zic.c 26 Oct 2007 13:28:46 -0000
***************
*** 6,12 ****
* $PostgreSQL: pgsql/src/timezone/zic.c,v 1.21 2007/02/01 19:10:30 momjian Exp $
*/

! #include "postgres.h"

#ifdef HAVE_GETOPT_H
#include <getopt.h>
--- 6,12 ----
* $PostgreSQL: pgsql/src/timezone/zic.c,v 1.21 2007/02/01 19:10:30 momjian Exp $
*/

! #include "postgres_fe.h"

#ifdef HAVE_GETOPT_H
#include <getopt.h>

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-10-26 14:19:22 Re: Fix ecpg dependency on postgres.h
Previous Message Tom Lane 2007-10-26 12:59:47 Re: Autovacuum cancellation