Some small code-restructuring issues - Mailing list pgsql-hackers

From Tom Lane
Subject Some small code-restructuring issues
Date
Msg-id 24598.1150824006@sss.pgh.pa.us
Whole thread Raw
Responses Re: Some small code-restructuring issues  (Stephen Frost <sfrost@snowman.net>)
List pgsql-hackers
In pursuit of eliminating some redundant gettimeofday() calls, I just
tried to change struct Port's session_start field to TimestampTz,
which necessitated including utils/timestamp.h in libpq/libpq-be.h.
That caused things to blow up real good :-(.  The problem is that
backend/libpq/md5.c includes c.h (not postgres.h) and then
libpq/crypt.h, and then the latter includes libpq/libpq-be.h, and that
fails because c.h doesn't define such things as Datum.

This is all pretty horrid code really, and I think we need to clean it
up.  A relatively minimal fix would be to separate out the declarations
for md5.c into its own header file include/libpq/md5.h, which would not
need to include any backend-only definitions.  More aggressively, we
could decide that since md5.c and ip.c are supposed to be both backend
and frontend code, they don't belong here at all, but should be in
libpgport (ie, move 'em to src/port).  Moving them would lose some CVS
history but would probably be the cleanest thing in the long run.
Comments?
        regards, tom lane


pgsql-hackers by date:

Previous
From: ohp@pyrenet.fr
Date:
Subject: Re: pltcl -- solved
Next
From: Tom Lane
Date:
Subject: Re: Slightly bogus regression test for contrib/dblink