annotate lib/xmemdup0.h @ 17409:26a04e61f560

stdio: use __REDIRECT for fwrite, fwrite_unlocked * lib/stdio.in.h (fwrite): When working around bug 11959, use __REDIRECT rather than '#define fwrite(...) ... fwrite (...) ...'. This is a more-targeted way to fix the -Wunused-value issue with clang, and it works with GCC too. Problem with targeting reported by Eric Blake in <http://lists.gnu.org/archive/html/bug-gnulib/2013-05/msg00067.html>. (fwrite_unlocked): Treat like fwrite. I ran into this issue while debugging the fwrite issue.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 15 May 2013 15:52:42 -0700
parents e542fd46ad6f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10068
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
1 /* xmemdup0.h -- copy a block of arbitrary bytes, plus a trailing NUL
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
2
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16201
diff changeset
3 Copyright (C) 2008-2013 Free Software Foundation, Inc.
10068
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
4
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
5 This program is free software: you can redistribute it and/or modify
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
6 it under the terms of the GNU General Public License as published by
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
8 (at your option) any later version.
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
9
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
13 GNU General Public License for more details.
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
14
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
15 You should have received a copy of the GNU General Public License
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
17
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
18 #ifndef XMEMDUP_H_
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
19 # define XMEMDUP_H_
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
20
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
21 # include <stddef.h>
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
22
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
23
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
24 # ifdef __cplusplus
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
25 extern "C" {
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
26 # endif
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
27
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
28 /* This function is always triggered when memory is exhausted.
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
29 It must be defined by the application, either explicitly
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
30 or by using gnulib's xalloc-die module. This is the
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
31 function to call when one wants the program to die because of a
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
32 memory allocation failure. */
15412
7f0f3e1ac6fd stdnoreturn, stdnoreturn-tests: remove modules
Paul Eggert <eggert@cs.ucla.edu>
parents: 15406
diff changeset
33 extern _Noreturn void xalloc_die (void);
10068
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
34
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
35 char *xmemdup0 (void const *p, size_t s);
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
36
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
37 # ifdef __cplusplus
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
38 }
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
39 # endif
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
40
c7189e3f4fa9 Split xmemdup0 into its own module.
Eric Blake <ebb9@byu.net>
parents:
diff changeset
41 #endif /* !XMEMDUP0_H_ */