Strdup

From Valve Developer Community
Revision as of 20:09, 12 January 2006 by Ts2do (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Defined in src\vgui2\controls\BitmapImagePanel.cpp and only used there, this function simply returns a pointer to a clone of the string parameter. This function handles the repetative code that is seen when copying a string and makes it an inline function.

static inline char *CloneString( const char *str )
{
	char *cloneStr = new char [ strlen(str)+1 ];
	strcpy( cloneStr, str );
	return cloneStr;
}