Обсуждение: fix ZIC dependency on postgres.h
I attached patch which removes dependency on postgres.h during ZIC compilation. It was discussed there: http://archives.postgresql.org/pgsql-hackers/2007-10/msg01261.php Zdenek Index: src/include/pgtime.h =================================================================== RCS file: /zfs_data/cvs_pgsql/cvsroot/pgsql/src/include/pgtime.h,v retrieving revision 1.17 diff -c -r1.17 pgtime.h *** src/include/pgtime.h 4 Aug 2007 19:29:25 -0000 1.17 --- src/include/pgtime.h 26 Oct 2007 10:14:09 -0000 *************** *** 13,18 **** --- 13,19 ---- #ifndef _PGTIME_H #define _PGTIME_H + #include "c.h" /* * The API of this library is generally similar to the corresponding Index: src/timezone/ialloc.c =================================================================== RCS file: /zfs_data/cvs_pgsql/cvsroot/pgsql/src/timezone/ialloc.c,v retrieving revision 1.8 diff -c -r1.8 ialloc.c *** src/timezone/ialloc.c 26 Jan 2007 17:45:42 -0000 1.8 --- src/timezone/ialloc.c 26 Oct 2007 10:12:51 -0000 *************** *** 6,13 **** * $PostgreSQL: pgsql/src/timezone/ialloc.c,v 1.7 2005/10/15 02:49:51 momjian Exp $ */ - #include "postgres.h" - #include "private.h" --- 6,11 ---- Index: src/timezone/localtime.c =================================================================== RCS file: /zfs_data/cvs_pgsql/cvsroot/pgsql/src/timezone/localtime.c,v retrieving revision 1.17 diff -c -r1.17 localtime.c *** src/timezone/localtime.c 4 Aug 2007 19:29:25 -0000 1.17 --- src/timezone/localtime.c 26 Oct 2007 10:12:51 -0000 *************** *** 12,19 **** * (guy@auspex.com). */ - #include "postgres.h" - #include <fcntl.h> #include "private.h" --- 12,17 ---- Index: src/timezone/scheck.c =================================================================== RCS file: /zfs_data/cvs_pgsql/cvsroot/pgsql/src/timezone/scheck.c,v retrieving revision 1.7 diff -c -r1.7 scheck.c *** src/timezone/scheck.c 15 Oct 2005 02:49:51 -0000 1.7 --- src/timezone/scheck.c 26 Oct 2007 10:12:51 -0000 *************** *** 6,13 **** * $PostgreSQL: pgsql/src/timezone/scheck.c,v 1.6 2005/06/20 08:00:51 neilc Exp $ */ - #include "postgres.h" - #include "private.h" --- 6,11 ---- Index: src/timezone/zic.c =================================================================== RCS file: /zfs_data/cvs_pgsql/cvsroot/pgsql/src/timezone/zic.c,v retrieving revision 1.21 diff -c -r1.21 zic.c *** src/timezone/zic.c 1 Feb 2007 19:10:30 -0000 1.21 --- src/timezone/zic.c 26 Oct 2007 10:12:51 -0000 *************** *** 6,13 **** * $PostgreSQL: pgsql/src/timezone/zic.c,v 1.20 2007/01/26 17:45:42 neilc Exp $ */ - #include "postgres.h" - #ifdef HAVE_GETOPT_H #include <getopt.h> #endif --- 6,11 ----
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>