27 lines
534 B
C
27 lines
534 B
C
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <string/stringbuffer.h>
|
|
#include <umalloc/umalloc.h>
|
|
#include <string/string.h>
|
|
#include <linearlist.h>
|
|
|
|
void stringbuffer_init(StringBuffer *sb) {
|
|
string_memset(sb, 0, sizeof(*sb));
|
|
}
|
|
|
|
void stringbuffer_free(StringBuffer *sb) {
|
|
LINLIST_FREE(sb);
|
|
}
|
|
|
|
void stringbuffer_appendchar(StringBuffer *sb, char c) {
|
|
LINLIST_APPEND(sb, c);
|
|
}
|
|
|
|
void stringbuffer_appendcstr(StringBuffer *sb, char *cstr) {
|
|
char *s = cstr;
|
|
while (*s) {
|
|
stringbuffer_appendchar(sb, *s);
|
|
s++;
|
|
}
|
|
}
|