From: phk Date: Fri, 15 Feb 2008 10:57:20 +0000 (+0000) Subject: A Give VLU_New() an optional buffersize argument X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52fcd984883d398bf6ff7d34ec3d203ed658bb00;p=varnish A Give VLU_New() an optional buffersize argument git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2473 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/mgt_child.c b/varnish-cache/bin/varnishd/mgt_child.c index 619ae810..0bad337c 100644 --- a/varnish-cache/bin/varnishd/mgt_child.c +++ b/varnish-cache/bin/varnishd/mgt_child.c @@ -229,7 +229,7 @@ start_child(void) AZ(close(child_fds[1])); child_fds[1] = -1; - vlu = VLU_New(NULL, child_line); + vlu = VLU_New(NULL, child_line, 0); AN(vlu); AZ(ev_listen); diff --git a/varnish-cache/include/vlu.h b/varnish-cache/include/vlu.h index 307f57f2..ffc76783 100644 --- a/varnish-cache/include/vlu.h +++ b/varnish-cache/include/vlu.h @@ -33,7 +33,7 @@ #define VLU_H_INCLUDED typedef int (vlu_f)(void *, const char *); -struct vlu *VLU_New(void *priv, vlu_f *func); +struct vlu *VLU_New(void *priv, vlu_f *func, unsigned bufsize); int VLU_Fd(int fd, struct vlu *l); int VLU_File(FILE *f, struct vlu *l); void VLU_Destroy(struct vlu *l); diff --git a/varnish-cache/lib/libvarnish/vlu.c b/varnish-cache/lib/libvarnish/vlu.c index 5f6c89a2..3c278b0b 100644 --- a/varnish-cache/lib/libvarnish/vlu.c +++ b/varnish-cache/lib/libvarnish/vlu.c @@ -48,15 +48,17 @@ struct vlu { }; struct vlu * -VLU_New(void *priv, vlu_f *func) +VLU_New(void *priv, vlu_f *func, unsigned bufsize) { struct vlu *l; + if (bufsize == 0) + bufsize = BUFSIZ; ALLOC_OBJ(l, LINEUP_MAGIC); if (l != NULL) { l->func = func; l->priv = priv; - l->bufl = BUFSIZ - 1; + l->bufl = bufsize - 1; l->buf = malloc(l->bufl + 1); if (l->buf == NULL) { FREE_OBJ(l);