Rename some pgstats callbacks related to flush of entries
[pgsql.git] / src / port / explicit_bzero.c
blob1d37b119bab1347c3764b9357fb15adf36c7d5f6
1 /*-------------------------------------------------------------------------
3 * explicit_bzero.c
5 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
6 * Portions Copyright (c) 1994, Regents of the University of California
9 * IDENTIFICATION
10 * src/port/explicit_bzero.c
12 *-------------------------------------------------------------------------
15 #include "c.h"
17 #if defined(HAVE_MEMSET_S)
19 void
20 explicit_bzero(void *buf, size_t len)
22 (void) memset_s(buf, len, 0, len);
25 #elif defined(WIN32)
27 void
28 explicit_bzero(void *buf, size_t len)
30 (void) SecureZeroMemory(buf, len);
33 #else
36 * Indirect call through a volatile pointer to hopefully avoid dead-store
37 * optimisation eliminating the call. (Idea taken from OpenSSH.) We can't
38 * assume bzero() is present either, so for simplicity we define our own.
41 static void
42 bzero2(void *buf, size_t len)
44 memset(buf, 0, len);
47 static void (*volatile bzero_p) (void *, size_t) = bzero2;
49 void
50 explicit_bzero(void *buf, size_t len)
52 bzero_p(buf, len);
55 #endif