From 6c36406a5dba3d390e2c98bd48c01bb1db86a985 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 11 Jul 2006 07:33:20 +0000 Subject: I added stringrep, which is a cpp replacement for some c string functions. They're all really simple, and maybe could even be optimized. I did this so that you could use the old c functions when you wanted to, but with cpp memory management. Also, some of these don't exist on other platforms, so it makes other programs more portable. The new functions are just like the c ones, only named string* instead of str*, for example stringdup instead of strdup. --- src/stringrep.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/stringrep.h (limited to 'src/stringrep.h') diff --git a/src/stringrep.h b/src/stringrep.h new file mode 100644 index 0000000..eaa4a12 --- /dev/null +++ b/src/stringrep.h @@ -0,0 +1,17 @@ +#ifndef STRING_REP_H +#define STRING_REP_H + +#include + +/** + * Calculates the length of a string. + */ +int32_t stringlen( const char *s ); + +/** + * Identicle to strdup, which isn't available everywhere, but uses c++ memory + * facilities. Remember to use delete[] when freeing the returned string. + */ +char *stringdup( const char *s ); + +#endif -- cgit v1.2.3