X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fconcat.c;h=9efe73180d894870b7e14e606b1950a0f7da0c39;hp=4c3fcff3e30689a71c60b7a79f396c8222487fec;hb=88b2142594d5ea1e8385dae5eca81eed1018c555;hpb=714b5c530ece27ea2835a313013f5b770163403c diff --git a/sbr/concat.c b/sbr/concat.c index 4c3fcff..9efe731 100644 --- a/sbr/concat.c +++ b/sbr/concat.c @@ -9,6 +9,18 @@ #include #include +#include + + +static char * +copy(char *from, char *to) +{ + while ((*to = *from)) { + to++; + from++; + } + return (to); +} char * @@ -24,7 +36,7 @@ concat(char *s1, ...) len += strlen(cp); va_end(list); - dp = sp = mh_xmalloc(len); + dp = sp = mh_xcalloc(len, sizeof(char)); sp = copy(s1, sp);