Re: fix ZIC dependency on postgres.h - Mailing list pgsql-patches

From Tom Lane
Subject Re: fix ZIC dependency on postgres.h
Date
Msg-id 14720.1193405561@sss.pgh.pa.us
Whole thread Raw
In response to fix ZIC dependency on postgres.h  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
List pgsql-patches
Zdenek Kotala <Zdenek.Kotala@Sun.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@auspex.com).
   */

! #include "postgres.h"

  #include <fcntl.h>

--- 12,19 ----
   * (guy@auspex.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>

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Autovacuum cancellation
Next
From: Tom Lane
Date:
Subject: Re: Fix ecpg dependency on postgres.h