1 /*****************************************************************************
2 * xstrcat.h: strcat with realloc
3 *****************************************************************************
4 * Copyright (C) 2004 Commonwealth Scientific and Industrial Research
5 * Organisation (CSIRO) Australia
6 * Copyright (C) 2004 the VideoLAN team
10 * Authors: Andre Pang <Andre.Pang@csiro.au>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 *****************************************************************************/
32 /* like strcat, but realloc's enough memory for the new string too */
35 char *xstrcat( char *psz_string, const char *psz_to_append )
37 size_t i_new_string_length = strlen( psz_string ) +
38 strlen( psz_to_append ) + 1;
40 psz_string = (char *) realloc( psz_string, i_new_string_length );
42 return strcat( psz_string, psz_to_append );
45 #endif /* __XSTRCAT_H__ */