Lines Matching refs:buf
52 static size_t zend_stream_stdio_reader(void *handle, char *buf, size_t len) /* {{{ */ in zend_stream_stdio_reader() argument
54 return fread(buf, 1, len, (FILE*)handle); in zend_stream_stdio_reader()
66 zend_stat_t buf; in zend_stream_stdio_fsizer() local
67 if (handle && zend_fstat(fileno((FILE*)handle), &buf) == 0) { in zend_stream_stdio_fsizer()
69 if (!S_ISREG(buf.st_mode)) { in zend_stream_stdio_fsizer()
73 return buf.st_size; in zend_stream_stdio_fsizer()
84 if (stream->mmap.buf) { in zend_stream_unmap()
85 efree(stream->mmap.buf); in zend_stream_unmap()
90 stream->mmap.buf = 0; in zend_stream_unmap()
108 zend_stat_t buf; in zend_stream_fsize() local
116 if (file_handle->handle.fp && zend_fstat(fileno(file_handle->handle.fp), &buf) == 0) { in zend_stream_fsize()
118 if (!S_ISREG(buf.st_mode)) { in zend_stream_fsize()
122 return buf.st_size; in zend_stream_fsize()
145 char buf; in zend_stream_getc() local
147 if (file_handle->handle.stream.reader(file_handle->handle.stream.handle, &buf, sizeof(buf))) { in zend_stream_getc()
148 return (int)buf; in zend_stream_getc()
153 static size_t zend_stream_read(zend_file_handle *file_handle, char *buf, size_t len) /* {{{ */ argument
169 buf[n] = (char)c;
172 buf[n++] = (char)c;
177 return file_handle->handle.stream.reader(file_handle->handle.stream.handle, buf, len);
180 ZEND_API int zend_stream_fixup(zend_file_handle *file_handle, char **buf, size_t *len) /* {{{ */ argument
213 *buf = file_handle->handle.stream.mmap.buf;
237 … *buf = mmap(0, size + ZEND_MMAP_AHEAD, PROT_READ, MAP_PRIVATE, fileno(file_handle->handle.fp), 0);
238 if (*buf != MAP_FAILED) {
240 file_handle->handle.stream.mmap.map = *buf;
243 *buf += offset;
246 file_handle->handle.stream.mmap.buf = *buf;
254 file_handle->handle.stream.mmap.buf = *buf = safe_emalloc(1, size, ZEND_MMAP_AHEAD);
255 file_handle->handle.stream.mmap.len = zend_stream_read(file_handle, *buf, size);
258 *buf = emalloc(remain);
261 while ((read = zend_stream_read(file_handle, *buf + size, remain)) > 0) {
266 *buf = safe_erealloc(*buf, size, 2, 0);
273 *buf = safe_erealloc(*buf, size, 1, ZEND_MMAP_AHEAD);
275 file_handle->handle.stream.mmap.buf = *buf;
279 *buf = erealloc(*buf, ZEND_MMAP_AHEAD);
280 file_handle->handle.stream.mmap.buf = *buf;
284 …memset(file_handle->handle.stream.mmap.buf + file_handle->handle.stream.mmap.len, 0, ZEND_MMAP_AHE…
296 *buf = file_handle->handle.stream.mmap.buf;