Lines Matching refs:lf

358 lf_init (struct line_filter *lf, FILE *infile)  in lf_init()  argument
360 lf->infile = infile; in lf_init()
361 lf->bufpos = lf->buffer = lf->buflim = xmalloc (SDIFF_BUFSIZE + 1); in lf_init()
362 lf->buflim[0] = '\n'; in lf_init()
367 lf_refill (struct line_filter *lf) in lf_refill() argument
369 size_t s = ck_fread (lf->buffer, SDIFF_BUFSIZE, lf->infile); in lf_refill()
370 lf->bufpos = lf->buffer; in lf_refill()
371 lf->buflim = lf->buffer + s; in lf_refill()
372 lf->buflim[0] = '\n'; in lf_refill()
379 lf_copy (struct line_filter *lf, lin lines, FILE *outfile) in lf_copy() argument
381 char *start = lf->bufpos; in lf_copy()
385 lf->bufpos = (char *) memchr (lf->bufpos, '\n', lf->buflim - lf->bufpos); in lf_copy()
386 if (! lf->bufpos) in lf_copy()
388 ck_fwrite (start, lf->buflim - start, outfile); in lf_copy()
389 if (! lf_refill (lf)) in lf_copy()
391 start = lf->bufpos; in lf_copy()
396 ++lf->bufpos; in lf_copy()
400 ck_fwrite (start, lf->bufpos - start, outfile); in lf_copy()
405 lf_skip (struct line_filter *lf, lin lines) in lf_skip() argument
409 lf->bufpos = (char *) memchr (lf->bufpos, '\n', lf->buflim - lf->bufpos); in lf_skip()
410 if (! lf->bufpos) in lf_skip()
412 if (! lf_refill (lf)) in lf_skip()
418 ++lf->bufpos; in lf_skip()
425 lf_snarf (struct line_filter *lf, char *buffer, size_t bufsize) in lf_snarf() argument
429 char *start = lf->bufpos; in lf_snarf()
430 char *next = (char *) memchr (start, '\n', lf->buflim + 1 - start); in lf_snarf()
435 if (next < lf->buflim) in lf_snarf()
438 lf->bufpos = next + 1; in lf_snarf()
441 if (! lf_refill (lf)) in lf_snarf()