projects
/
mmh
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
merge pick and scan manpage
[mmh]
/
sbr
/
concat.c
diff --git
a/sbr/concat.c
b/sbr/concat.c
index
4c3fcff
..
9efe731
100644
(file)
--- a/
sbr/concat.c
+++ b/
sbr/concat.c
@@
-9,6
+9,18
@@
#include <h/mh.h>
#include <h/utils.h>
#include <h/mh.h>
#include <h/utils.h>
+#include <stdarg.h>
+
+
+static char *
+copy(char *from, char *to)
+{
+ while ((*to = *from)) {
+ to++;
+ from++;
+ }
+ return (to);
+}
char *
char *
@@
-24,7
+36,7
@@
concat(char *s1, ...)
len += strlen(cp);
va_end(list);
len += strlen(cp);
va_end(list);
- dp = sp = mh_xmalloc(len);
+ dp = sp = mh_xcalloc(len, sizeof(char));
sp = copy(s1, sp);
sp = copy(s1, sp);