#include #include #include "es.h" void es_init(ES *e) { e->b = 0; e->a = 0; e->l = 0; } void es_done(ES *e) { free(e->b); } char *es_ptr(ES *e) { return(e->b); } int es_len(ES *e) { return(e->l); } void es_clear(ES *e) { e->l = 0; } void es_append_n(ES *e, const void *b, int l) { if (e->l+l > e->a) { e->a = e->l + l + 8; e->b = realloc(e->b,e->a); } bcopy(b,e->b+e->l,l); e->l += l; } void es_append_1(ES *e, char c) { es_append_n(e,&c,1); }