newlen= vb->used+len;
if (vb->avail < newlen) {
+ if (newlen<20) newlen= 20;
newlen <<= 1;
nb= realloc(vb->buf,newlen);
- if (!nb) { newlen >>= 1; nb= realloc(vb->buf,newlen); }
+ if (!nb) { newlen= vb->used+len; nb= realloc(vb->buf,newlen); }
if (!nb) return 0;
vb->buf= nb;
vb->avail= newlen;
return 1;
}
+int adns__vbuf_appendstr(vbuf *vb, const char *data) {
+ int l;
+ l= strlen(data);
+ return adns__vbuf_append(vb,data,l);
+}
+
+void adns__vbuf_free(vbuf *vb) {
+ free(vb->buf);
+ adns__vbuf_init(vb);
+}
+
/* Additional diagnostic functions */
const char *adns__diag_domain(adns_state ads, int serv, adns_query qu, vbuf *vb,