Lines Matching refs:b
44 buffer_init(struct buffer *b, int fd, const zend_stat_t *st, const void *data, in buffer_init() argument
47 b->fd = fd; in buffer_init()
49 memcpy(&b->st, st, sizeof(b->st)); in buffer_init()
50 else if (b->fd == -1 || zend_fstat(b->fd, &b->st) == -1) in buffer_init()
51 memset(&b->st, 0, sizeof(b->st)); in buffer_init()
52 b->fbuf = data; in buffer_init()
53 b->flen = len; in buffer_init()
54 b->eoff = 0; in buffer_init()
55 b->ebuf = NULL; in buffer_init()
56 b->elen = 0; in buffer_init()
60 buffer_fini(struct buffer *b) in buffer_fini() argument
62 efree(b->ebuf); in buffer_fini()
68 struct buffer *b = CCAST(struct buffer *, bb); in buffer_fill() local
70 if (b->elen != 0) in buffer_fill()
71 return b->elen == FILE_BADSIZE ? -1 : 0; in buffer_fill()
73 if (!S_ISREG(b->st.st_mode)) in buffer_fill()
76 b->elen = CAST(size_t, b->st.st_size) < b->flen ? in buffer_fill()
77 CAST(size_t, b->st.st_size) : b->flen; in buffer_fill()
78 if ((b->ebuf = emalloc(b->elen)) == NULL) in buffer_fill()
81 b->eoff = b->st.st_size - b->elen; in buffer_fill()
82 if (FINFO_LSEEK_FUNC(b->fd, b->eoff, SEEK_SET) == (zend_off_t)-1 || in buffer_fill()
83 FINFO_READ_FUNC(b->fd, b->ebuf, b->elen) != (ssize_t)b->elen) in buffer_fill()
85 efree(b->ebuf); in buffer_fill()
86 b->ebuf = NULL; in buffer_fill()
92 b->elen = FILE_BADSIZE; in buffer_fill()