GDB (API)
/home/stan/gdb/src/gdb/gdb_obstack.c
Go to the documentation of this file.
00001 /* Obstack wrapper for GDB.
00002 
00003    Copyright (C) 2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #include "defs.h"
00021 #include "gdb_obstack.h"
00022 
00023 /* Concatenate NULL terminated variable argument list of `const char *'
00024    strings; return the new string.  Space is found in the OBSTACKP.
00025    Argument list must be terminated by a sentinel expression `(char *)
00026    NULL'.  */
00027 
00028 char *
00029 obconcat (struct obstack *obstackp, ...)
00030 {
00031   va_list ap;
00032 
00033   va_start (ap, obstackp);
00034   for (;;)
00035     {
00036       const char *s = va_arg (ap, const char *);
00037 
00038       if (s == NULL)
00039         break;
00040 
00041       obstack_grow_str (obstackp, s);
00042     }
00043   va_end (ap);
00044   obstack_1grow (obstackp, 0);
00045 
00046   return obstack_finish (obstackp);
00047 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines