diff options
author | 2009-09-09 08:15:46 -0400 | |
---|---|---|
committer | 2009-09-09 08:15:46 -0400 | |
commit | 3b86930c9adf12117a7cc600a20288020e2660f5 (patch) | |
tree | 1df04b9ac5d1ea383a6c6c572d2a707bd3ceee69 /src/c/urweb.c | |
parent | 2b5e957c78d47ae6d66ee2f70435b827d1644a4f (diff) |
Find chances to use mstrcat()
Diffstat (limited to 'src/c/urweb.c')
-rw-r--r-- | src/c/urweb.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c index 651cef17..774c5797 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -2836,3 +2836,23 @@ uw_Basis_string uw_Basis_unAs(uw_context ctx, uw_Basis_string s) { return r; } +uw_Basis_string uw_Basis_mstrcat(uw_context ctx, ...) { + va_list ap; + size_t len = 1; + char *s, *r, *s2; + + va_start(ap, ctx); + for (s = va_arg(ap, char*); s; s = va_arg(ap, char*)) + len += strlen(s); + va_end(ap); + + r = uw_malloc(ctx, len); + va_start(ap, ctx); + for (s2 = r, s = va_arg(ap, char*); s; s = va_arg(ap, char*)) + while (*s) + *s2++ = *s++; + va_end(ap); + *s2 = 0; + + return r; +} |