Skip to content

Commit 3438c98

Browse files
committed
Use plain memset() in numeric.c, not MemSet and friends.
This essentially reverts a micro-optimization I made years ago, as part of the much larger commit d72f6c7. It's doubtful that there was any hard evidence for it being helpful even then, and the case is even more dubious now that modern compilers are so much smarter about inlining memset(). The proximate reason for undoing it is to get rid of the type punning inherent in MemSet, for fear that that may cause problems now that we're applying additional optimization switches to numeric.c. At the very least this'll silence some warnings from a few old buildfarm animals. (It's probably past time for another look at whether MemSet is still worth anything at all, but I do not propose to tackle that question right now.) Discussion: https://postgr.es/m/CAJ3gD9evtA_vBo+WMYMyT-u=keHX7-r8p2w7OSRfXf42LTwCZQ@mail.gmail.com
1 parent 728d4bc commit 3438c98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/utils/adt/numeric.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ static void dump_var(const char *str, NumericVar *var);
492492
pfree(buf); \
493493
} while (0)
494494

495-
#define init_var(v) MemSetAligned(v, 0, sizeof(NumericVar))
495+
#define init_var(v) memset(v, 0, sizeof(NumericVar))
496496

497497
#define NUMERIC_DIGITS(num) (NUMERIC_HEADER_IS_SHORT(num) ? \
498498
(num)->choice.n_short.n_data : (num)->choice.n_long.n_data)

0 commit comments

Comments
 (0)