Lines Matching full:fr
84 struct file_reader *fr; member
392 struct file_reader *fr; in check() local
400 fr = file_reader_init(fn); in check()
406 if (fr == NULL) { in check()
411 s1 = file_reader_readline(fr); in check()
418 s2 = file_reader_readline(fr); in check()
465 s2 = file_reader_readline(fr); in check()
492 s2 = file_reader_readline(fr); in check()
499 file_reader_free(fr); in check()
653 file_reader_readline(struct file_reader *fr) in file_reader_readline() argument
657 if (fr->mmapaddr) { in file_reader_readline()
660 mmapend = fr->mmapaddr + fr->mmapsize; in file_reader_readline()
661 if (fr->mmapptr >= mmapend) in file_reader_readline()
667 sz = mmapend - fr->mmapptr; in file_reader_readline()
668 strend = memchr(fr->mmapptr, fr->elsymb, sz); in file_reader_readline()
671 ret = bwscsbdup(fr->mmapptr, sz); in file_reader_readline()
672 fr->mmapptr = mmapend; in file_reader_readline()
674 ret = bwscsbdup(fr->mmapptr, strend - in file_reader_readline()
675 fr->mmapptr); in file_reader_readline()
676 fr->mmapptr = strend + 1; in file_reader_readline()
682 len = getdelim(&fr->buffer, &fr->bsz, fr->elsymb, fr->file); in file_reader_readline()
684 if (!feof(fr->file)) in file_reader_readline()
688 if (len > 0 && fr->buffer[len - 1] == fr->elsymb) in file_reader_readline()
690 ret = bwscsbdup(fr->buffer, len); in file_reader_readline()
697 file_reader_clean(struct file_reader *fr) in file_reader_clean() argument
700 if (fr == NULL) in file_reader_clean()
703 if (fr->mmapaddr) in file_reader_clean()
704 munmap(fr->mmapaddr, fr->mmapsize); in file_reader_clean()
705 if (fr->fd) in file_reader_clean()
706 close(fr->fd); in file_reader_clean()
708 free(fr->buffer); in file_reader_clean()
709 closefile(fr->file, fr->fname); in file_reader_clean()
710 free(fr->fname); in file_reader_clean()
711 memset(fr, 0, sizeof(struct file_reader)); in file_reader_clean()
715 file_reader_free(struct file_reader *fr) in file_reader_free() argument
718 if (fr == NULL) in file_reader_free()
720 file_reader_clean(fr); in file_reader_free()
721 free(fr); in file_reader_free()
727 struct file_reader *fr; in procfile() local
729 fr = file_reader_init(fsrc); in procfile()
730 if (fr == NULL) in procfile()
737 bws = file_reader_readline(fr); in procfile()
754 file_reader_free(fr); in procfile()
769 if (f1->fr == NULL) { in file_header_cmp()
770 return ((f2->fr == NULL) ? 0 : +1); in file_header_cmp()
771 } else if (f2->fr == NULL) in file_header_cmp()
796 (*fh)->fr = file_reader_init(fn); in file_header_init()
797 if ((*fh)->fr == NULL) { in file_header_init()
801 line = file_reader_readline((*fh)->fr); in file_header_init()
803 file_reader_free((*fh)->fr); in file_header_init()
804 (*fh)->fr = NULL; in file_header_init()
821 file_reader_free((*fh)->fr); in file_header_close()
822 (*fh)->fr = NULL; in file_header_close()
932 if (fh && fh->fr && f_out && fh->si && fh->si->str) { in file_header_print()
952 if (fh && fh->fr) { in file_header_read_next()
955 tmp = file_reader_readline(fh->fr); in file_header_read_next()
957 file_reader_free(fh->fr); in file_header_read_next()
958 fh->fr = NULL; in file_header_read_next()
989 while (fh[0]->fr) { /* unfinished files are always in front */ in file_headers_merge()