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