xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/gnulib-lib/xasprintf.c (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1*946379e7Schristos /* vasprintf and asprintf with out-of-memory checking.
2*946379e7Schristos    Copyright (C) 1999, 2002-2004, 2006 Free Software Foundation, Inc.
3*946379e7Schristos 
4*946379e7Schristos    This program is free software; you can redistribute it and/or modify
5*946379e7Schristos    it under the terms of the GNU General Public License as published by
6*946379e7Schristos    the Free Software Foundation; either version 2, or (at your option)
7*946379e7Schristos    any later version.
8*946379e7Schristos 
9*946379e7Schristos    This program is distributed in the hope that it will be useful,
10*946379e7Schristos    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*946379e7Schristos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*946379e7Schristos    GNU General Public License for more details.
13*946379e7Schristos 
14*946379e7Schristos    You should have received a copy of the GNU General Public License along
15*946379e7Schristos    with this program; if not, write to the Free Software Foundation,
16*946379e7Schristos    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17*946379e7Schristos 
18*946379e7Schristos #include <config.h>
19*946379e7Schristos 
20*946379e7Schristos /* Specification.  */
21*946379e7Schristos #include "xvasprintf.h"
22*946379e7Schristos 
23*946379e7Schristos char *
xasprintf(const char * format,...)24*946379e7Schristos xasprintf (const char *format, ...)
25*946379e7Schristos {
26*946379e7Schristos   va_list args;
27*946379e7Schristos   char *result;
28*946379e7Schristos 
29*946379e7Schristos   va_start (args, format);
30*946379e7Schristos   result = xvasprintf (format, args);
31*946379e7Schristos   va_end (args);
32*946379e7Schristos 
33*946379e7Schristos   return result;
34*946379e7Schristos }
35