Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

xstrcat.h

00001 /*****************************************************************************
00002  * xstrcat.h: strcat with realloc
00003  *****************************************************************************
00004  * Copyright (C) 2004 Commonwealth Scientific and Industrial Research
00005  *                    Organisation (CSIRO) Australia
00006  * Copyright (C) 2004 the VideoLAN team
00007  *
00008  * $Id: xstrcat.h 11664 2005-07-09 06:17:09Z courmisch $
00009  *
00010  * Authors: Andre Pang <[email protected]>
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  * 
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00025  *****************************************************************************/
00026 
00027 #ifndef __XSTRCAT_H__
00028 #define __XSTRCAT_H__
00029 
00030 /* like strcat, but realloc's enough memory for the new string too */
00031 
00032 static inline
00033 char *xstrcat( char *psz_string, const char *psz_to_append )
00034 {
00035     size_t i_new_string_length = strlen( psz_string ) +
00036         strlen( psz_to_append ) + 1;
00037 
00038     psz_string = (char *) realloc( psz_string, i_new_string_length );
00039 
00040     return strcat( psz_string, psz_to_append );
00041 }
00042 
00043 #endif /* __XSTRCAT_H__ */
00044 

Generated on Tue Dec 20 10:14:28 2005 for vlc-0.8.4a by  doxygen 1.4.2