Consistently use "superuser" instead of "super user"
[pgsql.git] / src / port / explicit_bzero.c
blobe39e20b8a569fc789acf8d9fe4bb6ee32f34f20b
1 /*-------------------------------------------------------------------------
3 * explicit_bzero.c
5 * Portions Copyright (c) 1996-2021, 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