summaryrefslogtreecommitdiff
path: root/generic/String.cpp
diff options
context:
space:
mode:
authorPixel <Pixel>2002-08-25 14:39:48 +0000
committerPixel <Pixel>2002-08-25 14:39:48 +0000
commit38d60726082b04e79edae1c8c797c6dcb8314504 (patch)
tree4a056a158c6fc21c29dd8d8ed94c010a25cee19a /generic/String.cpp
parent1b0a5db816b7610c83615e93095155b1709f55da (diff)
Workiiiiiiiiiiiiiiiiiing!!!!
Diffstat (limited to 'generic/String.cpp')
-rw-r--r--generic/String.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/generic/String.cpp b/generic/String.cpp
index c389c13..22d77d6 100644
--- a/generic/String.cpp
+++ b/generic/String.cpp
@@ -14,7 +14,11 @@ extern "C" {
char String::t[BUFSIZ + 1];
-String::String(const String & s) : str(Base::strdup(s.str)), siz(s.siz) { }
+String::String(const String & s) : str(Base::strdup(s.str)), siz(s.siz) {
+#ifdef DEBUG
+ fprintf(stderr, "Duplicating string `%s', from %p to %p\n", str, s.str, str);
+#endif
+}
String::String(char c) : siz(1) {
char * t = (char *) malloc(2);
@@ -23,8 +27,17 @@ String::String(char c) : siz(1) {
str = t;
}
+String::String(const char * s) : str(Base::strdup(s)), siz(::strlen(str)) {
+#ifdef DEBUG
+ fprintf(stderr, "Creating a string with `%s' at %p\n", str, str);
+#endif
+}
+
+#if 0
String::String(const char * s, ...) {
va_list ap;
+
+ fprintf(stderr, "Creating a String with s = '%s'\n", s);
/* This causes a warning: cannot pass objects of type `const String' through `...'
but it is not really a problem. */
@@ -33,7 +46,8 @@ String::String(const char * s, ...) {
str = Base::strdup(t);
va_end(ap);
siz = ::strlen(str);
-}
+}
+#endif
String::String(int hs, const char * s) : str(s ? Base::strdup(s) : Base::strdup("")), siz(hs) { }