bloated heapam.h - Mailing list pgsql-hackers

From Alvaro Herrera
Subject bloated heapam.h
Date
Msg-id 20080509185610.GJ5748@alvh.no-ip.org
Whole thread Raw
Responses Re: bloated heapam.h  (Zdenek Kotala <Zdenek.Kotala@Sun.COM>)
List pgsql-hackers
Hi,

I noticed heapam.h is included in way too many places.  This is bad IMHO
because heapam.h itself includes a lot of other headers.

A lot of these are easy to fix; the source files just need to include
some other headers.  Standard cleanup, I don't think anybody would
object to that.  For example,

Index: src/backend/access/gin/ginvacuum.c
===================================================================
RCS file: /home/alvherre/Code/cvs/pgsql/src/backend/access/gin/ginvacuum.c,v
retrieving revision 1.19
diff -c -p -r1.19 ginvacuum.c
*** src/backend/access/gin/ginvacuum.c  1 Jan 2008 19:45:46 -0000   1.19
--- src/backend/access/gin/ginvacuum.c  9 May 2008 18:44:31 -0000
***************
*** 15,24 **** #include "postgres.h" #include "access/genam.h" #include "access/gin.h"
- #include "access/heapam.h" #include "miscadmin.h" #include "storage/freespace.h"
! #include "storage/freespace.h" #include "commands/vacuum.h"  typedef struct
--- 15,23 ---- #include "postgres.h" #include "access/genam.h" #include "access/gin.h" #include "miscadmin.h" #include
"storage/freespace.h"
! #include "storage/lmgr.h" #include "commands/vacuum.h"  typedef struct


Others are more conflictive.  For example syncscan.c is keeping the
prototypes for its own functions on heapam.h.  Also pruneheap.c and
rewriteheap.c.  As a result, not only themselves need to include
heapam.h (without any other need for it), but they force some other
files into including heapam.h to get their prototypes.  I think this is
a mistake; I propose splitting those prototypes to their own files, and
#including those as appropriate.

Objections?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


pgsql-hackers by date:

Previous
From: Aidan Van Dyk
Date:
Subject: Re: psql wrapped format default for backslash-d commands
Next
From: Stephen Frost
Date:
Subject: Re: constraint exclusion analysis caching