pgsql: Change dynahash.c and hsearch.h to use int64 instead of long

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Change dynahash.c and hsearch.h to use int64 instead of long
Дата
Msg-id E1upI08-0014RL-0i@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Change dynahash.c and hsearch.h to use int64 instead of long

This code was relying on "long", which is signed 8 bytes everywhere
except on Windows where it is 4 bytes, that could potentially expose it
to overflows, even if the current uses in the code are fine as far as I
know.  This code is now able to rely on the same sizeof() variable
everywhere, with int64.  long was used for sizes, partition counts and
entry counts.

Some callers of the dynahash.c routines used long declarations, that can
be cleaned up to use int64 instead.  There was one shortcut based on
SIZEOF_LONG, that can be removed.  long is entirely removed from
dynahash.c and hsearch.h.

Similar work was done in b1e5c9fa9ac4.

Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aKQYp-bKTRtRauZ6@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/13b935cd5217457f62e9936fce668d15515a3072

Modified Files
--------------
contrib/pg_stat_statements/pg_stat_statements.c |  4 +-
src/backend/catalog/storage.c                   |  2 +-
src/backend/storage/ipc/shmem.c                 |  4 +-
src/backend/storage/lmgr/lock.c                 |  2 +-
src/backend/storage/lmgr/predicate.c            |  2 +-
src/backend/utils/hash/dynahash.c               | 92 ++++++++++++-------------
src/include/storage/shmem.h                     |  2 +-
src/include/utils/dynahash.h                    |  2 +-
src/include/utils/hsearch.h                     | 16 ++---
9 files changed, 61 insertions(+), 65 deletions(-)


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