diff options
Diffstat (limited to 'stralloc_catb.c')
-rw-r--r-- | stralloc_catb.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/stralloc_catb.c b/stralloc_catb.c new file mode 100644 index 0000000..8ee0af4 --- /dev/null +++ b/stralloc_catb.c | |||
@@ -0,0 +1,14 @@ | |||
1 | /* Public domain. */ | ||
2 | |||
3 | #include "stralloc.h" | ||
4 | #include "byte.h" | ||
5 | |||
6 | int stralloc_catb(stralloc *sa,const char *s,unsigned int n) | ||
7 | { | ||
8 | if (!sa->s) return stralloc_copyb(sa,s,n); | ||
9 | if (!stralloc_readyplus(sa,n + 1)) return 0; | ||
10 | byte_copy(sa->s + sa->len,n,s); | ||
11 | sa->len += n; | ||
12 | sa->s[sa->len] = 'Z'; /* ``offensive programming'' */ | ||
13 | return 1; | ||
14 | } | ||