Обсуждение: Some small code-restructuring issues

Поиск
Список
Период
Сортировка

Some small code-restructuring issues

От
Tom Lane
Дата:
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


Re: Some small code-restructuring issues

От
Stephen Frost
Дата:
* Tom Lane (tgl@sss.pgh.pa.us) wrote:
> 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?

Time to consider something other than CVS...?  In the end, personally
I'd rather have it be cleaner than the history.  There are ways to
preserve the history though, if it's a huge concern, even with CVS...
It's just ugly...
Enjoy,
    Stephen

Re: Some small code-restructuring issues

От
Alvaro Herrera
Дата:
Stephen Frost wrote:
> * Tom Lane (tgl@sss.pgh.pa.us) wrote:
> > 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?
> 
> Time to consider something other than CVS...?  In the end, personally
> I'd rather have it be cleaner than the history.  There are ways to
> preserve the history though, if it's a huge concern, even with CVS...
> It's just ugly...

Every hack to the repository makes it more difficult to get it to
migrate cleanly to something else.

A workaround of sorts would be to mention the origin of the files being
moved, so that an interested person can look it up via the Attic.

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


Re: Some small code-restructuring issues

От
Tom Lane
Дата:
Alvaro Herrera <alvherre@commandprompt.com> writes:
> A workaround of sorts would be to mention the origin of the files being
> moved, so that an interested person can look it up via the Attic.

Yeah, that should be sufficient.  The history is actually still there,
just attached to the old file location.
        regards, tom lane