diff options
author | joe <joe@jerkface.net> | 2015-05-08 23:07:47 -0400 |
---|---|---|
committer | joe <joe@jerkface.net> | 2015-05-08 23:07:47 -0400 |
commit | 220534453eecc2c07ad710d72268aafd20b83138 (patch) | |
tree | 469bd5db135e31b7ea908152aa3389b9b1e06d5b /stralloc_opyb.c |
initial commit
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 | } | ||