comparison src/c/urweb.c @ 922:d6a71f19a3d8

Find chances to use mstrcat()
author Adam Chlipala <adamc@hcoop.net>
date Wed, 09 Sep 2009 08:15:46 -0400
parents ae0110465421
children 552c989c1601
comparison
equal deleted inserted replaced
921:ae0110465421 922:d6a71f19a3d8
2834 } 2834 }
2835 2835
2836 return r; 2836 return r;
2837 } 2837 }
2838 2838
2839 uw_Basis_string uw_Basis_mstrcat(uw_context ctx, ...) {
2840 va_list ap;
2841 size_t len = 1;
2842 char *s, *r, *s2;
2843
2844 va_start(ap, ctx);
2845 for (s = va_arg(ap, char*); s; s = va_arg(ap, char*))
2846 len += strlen(s);
2847 va_end(ap);
2848
2849 r = uw_malloc(ctx, len);
2850 va_start(ap, ctx);
2851 for (s2 = r, s = va_arg(ap, char*); s; s = va_arg(ap, char*))
2852 while (*s)
2853 *s2++ = *s++;
2854 va_end(ap);
2855 *s2 = 0;
2856
2857 return r;
2858 }