Commit ccfa03fc authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Reintroduce VLU_Feed()

parent 86e8f721
......@@ -37,3 +37,4 @@ struct vlu *VLU_New(vlu_f *, void *, unsigned);
int VLU_Fd(struct vlu *, int);
void VLU_Destroy(struct vlu **);
int VLU_File(int, vlu_f *, void *, unsigned);
int VLU_Feed(struct vlu *, const char*, int);
......@@ -143,3 +143,26 @@ VLU_File(int fd, vlu_f *func, void *priv, unsigned bufsize)
VLU_Destroy(&vlu);
return (i);
}
int
VLU_Feed(struct vlu *l, const char *ptr, int len)
{
int i = 0, ll;
CHECK_OBJ_NOTNULL(l, LINEUP_MAGIC);
AN(ptr);
assert(len > 0);
while (len > 0) {
ll = len;
if (ll > l->bufl - l->bufp)
ll = l->bufl - l->bufp;
memcpy(l->buf + l->bufp, ptr, ll);
len -= ll;
ptr += ll;
l->bufp += ll;
i = LineUpProcess(l);
if (i)
return (i);
}
return (i);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment