git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 2084701) | patch
Simplify newNode() by removing special cases
2023年12月19日 10:11:47 +0000 (12:11 +0200)
2023年12月19日 10:11:47 +0000 (12:11 +0200)
commit 3c080fb4fad3e1c1e34f74a7b84a443137adc9f2
Simplify newNode() by removing special cases

- Remove MemoryContextAllocZeroAligned(). It was supposed to be a
faster version of MemoryContextAllocZero(), but modern compilers turn
the MemSetLoop() into a call to memset() anyway, making it more or
less identical to MemoryContextAllocZero(). That was the only user of
MemSetTest, MemSetLoop, so remove those too, as well as palloc0fast().

- Convert newNode() to a static inline function. When this was
originally originally written, it was written as a macro because
testing showed that gcc didn't inline the size check as we
intended. Modern compiler versions do, and now that it just calls
palloc0() there is no size-check to inline anyway.

One nice effect is that the palloc0() takes one less argument than
MemoryContextAllocZeroAligned(), which saves a few instructions in the
callers of newNode().

Reviewed-by: Peter Eisentraut, Tom Lane, John Naylor, Thomas Munro
Discussion: https://www.postgresql.org/message-id/b51f1fa7-7e6a-4ecc-936d-90a8a1659e7c@iki.fi
src/backend/nodes/Makefile diff | blob | blame | history
src/backend/nodes/meson.build diff | blob | blame | history
src/backend/nodes/nodes.c [deleted file] blob | blame | history
src/backend/utils/mmgr/mcxt.c diff | blob | blame | history
src/include/c.h diff | blob | blame | history
src/include/nodes/nodes.h diff | blob | blame | history
src/include/utils/palloc.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /