Lines Matching refs:buf
28 static ssize_t zend_stream_stdio_reader(void *handle, char *buf, size_t len) /* {{{ */ in zend_stream_stdio_reader() argument
30 return fread(buf, 1, len, (FILE*)handle); in zend_stream_stdio_reader()
42 zend_stat_t buf = {0}; in zend_stream_stdio_fsizer() local
43 if (handle && zend_fstat(fileno((FILE*)handle), &buf) == 0) { in zend_stream_stdio_fsizer()
45 if (!S_ISREG(buf.st_mode)) { in zend_stream_stdio_fsizer()
49 return buf.st_size; in zend_stream_stdio_fsizer()
101 char buf; in zend_stream_getc() local
103 if (file_handle->handle.stream.reader(file_handle->handle.stream.handle, &buf, sizeof(buf))) { in zend_stream_getc()
104 return (int)buf; in zend_stream_getc()
109 static ssize_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len) /* {{{ */ in zend_stream_read() argument
116 buf[n] = (char)c; in zend_stream_read()
119 buf[n++] = (char)c; in zend_stream_read()
124 return file_handle->handle.stream.reader(file_handle->handle.stream.handle, buf, len); in zend_stream_read()
127 ZEND_API zend_result zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {… in zend_stream_fixup() argument
131 if (file_handle->buf) { in zend_stream_fixup()
132 *buf = file_handle->buf; in zend_stream_fixup()
164 *buf = safe_emalloc(1, file_size, ZEND_MMAP_AHEAD); in zend_stream_fixup()
165 while ((read = zend_stream_read(file_handle, *buf + size, file_size - size)) > 0) { in zend_stream_fixup()
169 efree(*buf); in zend_stream_fixup()
172 file_handle->buf = *buf; in zend_stream_fixup()
177 *buf = emalloc(remain); in zend_stream_fixup()
179 while ((read = zend_stream_read(file_handle, *buf + size, remain)) > 0) { in zend_stream_fixup()
184 *buf = safe_erealloc(*buf, size, 2, 0); in zend_stream_fixup()
189 efree(*buf); in zend_stream_fixup()
195 *buf = safe_erealloc(*buf, size, 1, ZEND_MMAP_AHEAD); in zend_stream_fixup()
197 file_handle->buf = *buf; in zend_stream_fixup()
201 *buf = erealloc(*buf, ZEND_MMAP_AHEAD); in zend_stream_fixup()
202 file_handle->buf = *buf; in zend_stream_fixup()
205 memset(file_handle->buf + file_handle->len, 0, ZEND_MMAP_AHEAD); in zend_stream_fixup()
207 *buf = file_handle->buf; in zend_stream_fixup()
238 if (fh->buf) { in zend_file_handle_dtor()
239 efree(fh->buf); in zend_file_handle_dtor()
240 fh->buf = NULL; in zend_file_handle_dtor()