Re: [HACKERS] Function structure in formatting.c

Поиск
Список
Период
Сортировка
От Brendan Jurd
Тема Re: [HACKERS] Function structure in formatting.c
Дата
Msg-id 37ed240d0708100953q60b09fcbu8d6f1132878288bf@mail.gmail.com
обсуждение исходный текст
Ответы Re: [HACKERS] Function structure in formatting.c  (Bruce Momjian <bruce@momjian.us>)
Re: [HACKERS] Function structure in formatting.c  ("Brendan Jurd" <direvus@gmail.com>)
Список pgsql-patches
Hello,

As discussed on -hackers, I've done some refactoring work on
backend/utils/adt/formatting.c, in an attempt to make the code a bit
more intelligible before improving handling of bogus formats.

This is purely a refactor.  The functionality of the file hasn't
changed; it does the same job as before, but it does it in ~200 fewer
lines and ~3.5k fewer characters.  The clarity of code is greatly
improved.  Sadly, performance appears to be unchanged.

Summary of changes:

 * Did away with dch_global, dch_date and dch_time.
 * Replaced DCH_processor with two new functions DCH_to_char and
DCH_from_char, which now do all the work previously done by
dch_{global,date,time}.
 * Removed the 'action' field from the KeyWord struct as it is no longer useful.
 * Changed the type of the 'character' field in the FormatNode struct
to char, because ... that's what it is.  The original choice of 'int'
seems to have been an error.
 * Removed commented-out function declaration for is_acdc.  According
to CVS annotate, this hasn't been in use since sometime in the early
Cretaceous period, and in any case I don't know why you'd want to
check whether a string was the rock band AC/DC. =)
 * Reworded some of the comments for clarity.
 * Didn't touch any of the number formatting routines.

This compiles cleanly on x86 gentoo and passes check, installcheck and
installcheck-parallel.

Thanks for your time,
BJ

Вложения

В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Reduce the size of PageFreeSpaceInfo on 64bit platform
Следующее
От: Decibel!
Дата:
Сообщение: Re: Reduce the size of PageFreeSpaceInfo on 64bit platform