annotate lib/explicit_bzero.c @ 40231:9b3c79fdfe0b

strtod: fix clash with strtold Problem reported for RHEL 5 by Jesse Caldwell (Bug#34817). * lib/strtod.c (compute_minus_zero, minus_zero): Simplify by remving the macro / external variable, and having just a function. User changed. This avoids the need for an external variable that might clash.
author Paul Eggert <eggert@cs.ucla.edu>
date Mon, 11 Mar 2019 16:40:29 -0700
parents b06060465f09
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19001
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
1 /* Erasure of sensitive data, generic implementation.
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 39887
diff changeset
2 Copyright (C) 2016-2019 Free Software Foundation, Inc.
19001
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
3 This file is part of the GNU C Library.
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
4
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
5 The GNU C Library is free software; you can redistribute it and/or
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
9
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
10 The GNU C Library is distributed in the hope that it will be useful,
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
13 Lesser General Public License for more details.
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
14
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
16 License along with the GNU C Library; if not, see
19190
9759915b2aca all: prefer https: URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 19001
diff changeset
17 <https://www.gnu.org/licenses/>. */
19001
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
18
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
19 /* An assembler implementation of explicit_bzero can be created as an
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
20 assembler alias of an optimized bzero implementation.
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
21 Architecture-specific implementations also need to define
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
22 __explicit_bzero_chk. */
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
23
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
24 #if !_LIBC
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
25 # include <config.h>
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
26 #endif
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
27
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
28 #include <string.h>
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
29
39887
e6ce7ef2af3e explicit_bzero: Make it possible to namespace the defined symbol.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
30 #if _LIBC
19001
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
31 /* glibc-internal users use __explicit_bzero_chk, and explicit_bzero
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
32 redirects to that. */
39887
e6ce7ef2af3e explicit_bzero: Make it possible to namespace the defined symbol.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
33 # undef explicit_bzero
e6ce7ef2af3e explicit_bzero: Make it possible to namespace the defined symbol.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
34 #endif
19001
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
35
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
36 /* Set LEN bytes of S to 0. The compiler will not delete a call to
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
37 this function, even if S is dead after the call. */
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
38 void
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
39 explicit_bzero (void *s, size_t len)
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
40 {
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
41 #ifdef HAVE_EXPLICIT_MEMSET
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
42 explicit_memset (s, 0, len);
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
43 #else
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
44 memset (s, '\0', len);
19470
f64a50e6a1c1 explicit_bzero: port to macOS + Clang 9.0.0
Paul Eggert <eggert@cs.ucla.edu>
parents: 19190
diff changeset
45 # if defined __GNUC__ && !defined __clang__
19001
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
46 /* Compiler barrier. */
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
47 asm volatile ("" ::: "memory");
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
48 # endif
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
49 #endif
f1a31809efb2 explicit_bzero: new module
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff changeset
50 }