[Plib-cvs] plib/src/util ul.cxx,1.26,1.27 ul.h,1.44,1.45
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2002-06-20 06:39:40
|
Update of /cvsroot/plib/plib/src/util In directory usw-pr-cvs1:/tmp/cvs-serv9544/plib/src/util Modified Files: ul.cxx ul.h Log Message: Added ulStrDup() - please use instead of strdup(). Index: ul.cxx =================================================================== RCS file: /cvsroot/plib/plib/src/util/ul.cxx,v retrieving revision 1.26 retrieving revision 1.27 diff -u -d -r1.26 -r1.27 --- ul.cxx 7 Nov 2001 23:51:10 -0000 1.26 +++ ul.cxx 20 Jun 2002 06:39:36 -0000 1.27 @@ -359,6 +359,19 @@ ///////////////////// string handling /////////////////////////////// +/* + Strdup is *evil* - use this instead... +*/ + +char *ulStrDup ( const char *s ) +{ + char *ret = new char [ strlen(s)+1 ] ; + strcpy ( ret, s ) ; + return ret ; +} + + + // string comparisons that are *not* case sensitive: /* Index: ul.h =================================================================== RCS file: /cvsroot/plib/plib/src/util/ul.h,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- ul.h 10 Jun 2002 16:08:31 -0000 1.44 +++ ul.h 20 Jun 2002 06:39:36 -0000 1.45 @@ -756,6 +756,7 @@ } ; +extern char *ulStrDup ( const char *s ) ; extern int ulStrNEqual ( const char *s1, const char *s2, int len ); extern int ulStrEqual ( const char *s1, const char *s2 ); |