Re: [HACKERS] assorted code cleanup

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: [HACKERS] assorted code cleanup
Дата
Msg-id CAB7nPqQHnB_qS41P+Vsi=CrE3L2rjp37F8WX-dJceLzEWO+rvw@mail.gmail.com
обсуждение исходный текст
Ответ на [HACKERS] assorted code cleanup  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: [HACKERS] assorted code cleanup  (Michael Meskes <meskes@postgresql.org>)
Re: [HACKERS] assorted code cleanup  (Robert Haas <robertmhaas@gmail.com>)
Re: [HACKERS] assorted code cleanup  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
On Fri, Aug 18, 2017 at 1:56 AM, Peter Eisentraut
<peter.eisentraut@2ndquadrant.com> wrote:
> Here are a few assorted patches I made while working on the stdbool set,
> cleaning up various pieces of dead code and weird styles.
>
> - Drop excessive dereferencing of function pointers

-           (*next_ProcessUtility_hook) (pstmt, queryString,
+           next_ProcessUtility_hook(pstmt, queryString,                                        context, params,
queryEnv,                                       dest, completionTag);
 
But this... Personally I like the current grammar which allows one to
make the difference between a function call with something declared
locally and something that may be going to a custom code path. So I
think that you had better not update the system hooks that external
modules can use via shared_preload_libraries.

> - Remove endof macro

Its last use is 1aa58d3a from 2009.

> - Remove unnecessary casts

Those are also quite old things:
src/include/access/attnum.h:    ((bool) ((attributeNumber) !=
InvalidAttrNumber))
src/include/access/attnum.h:    ((bool) ((attributeNumber) > 0))
src/backend/utils/hash/dynahash.c:      *foundPtr = (bool) (currBucket != NULL);
[... etc ...]

> - Remove unnecessary parentheses in return statements

So you would still keep parenthesis like here for simple expressions:
contrib/bloom/blutils.c:    return (x - 1);
No objections.

Here are some more:
contrib/intarray/_int_bool.c:       return (calcnot) ?
contrib/ltree/ltxtquery_op.c:       return (calcnot) ?

And there are many "(0)" "S_ANYTHING" in src/interfaces/ecpg/test/ and
src/interfaces/ecpg/preproc/.

src/port/ stuff is better left off, good you did not touch it.

> - Remove our own definition of NULL

Fine. c.h uses once NULL before enforcing its definition.

> - fuzzystrmatch: Remove dead code

Those are remnants of a323ede, which missed to removed everything.
Looks good to me.
-- 
Michael



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

Предыдущее
От: Haribabu Kommi
Дата:
Сообщение: Re: [HACKERS] Refactor handling of database attributes betweenpg_dump and pg_dumpall
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] coverage analysis improvements