diff options
Diffstat (limited to 'generic/String.cpp')
-rw-r--r-- | generic/String.cpp | 18 |
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) { } |