]> git.ipfire.org Git - thirdparty/glibc.git/blame - locale/programs/xstrdup.c
Update copyright notices with scripts/update-copyrights
[thirdparty/glibc.git] / locale / programs / xstrdup.c
CommitLineData
0393dfd6 1/* xstrdup.c -- copy a string with out of memory checking
d4697bc9 2 Copyright (C) 1990-2014 Free Software Foundation, Inc.
478b92f0 3 This file is part of the GNU C Library.
0393dfd6 4
43bc8ac6 5 This program is free software; you can redistribute it and/or modify
2e2efe65
RM
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; version 2 of the License, or
8 (at your option) any later version.
0393dfd6 9
43bc8ac6 10 This program is distributed in the hope that it will be useful,
0393dfd6 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
43bc8ac6
UD
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
0393dfd6 14
43bc8ac6 15 You should have received a copy of the GNU General Public License
59ba27a6 16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
0393dfd6
RM
17
18#ifdef HAVE_CONFIG_H
39d1d4e5 19# include <config.h>
0393dfd6
RM
20#endif
21
52aac197 22#if defined STDC_HEADERS || defined HAVE_STRING_H || _LIBC
39d1d4e5 23# include <string.h>
0393dfd6 24#else
39d1d4e5 25# include <strings.h>
0393dfd6 26#endif
79937577
UD
27void *xmalloc (size_t n) __THROW;
28char *xstrdup (char *string) __THROW;
0393dfd6
RM
29
30/* Return a newly allocated copy of STRING. */
31
32char *
33xstrdup (string)
34 char *string;
35{
36 return strcpy (xmalloc (strlen (string) + 1), string);
37}