Lines Matching refs:cookie
50 fmemopen_read(void *cookie, void *buf, size_t nbytes)
55 _DIAGASSERT(cookie != NULL);
58 p = (struct fmemopen_cookie *)cookie;
70 fmemopen_write(void *cookie, const void *buf, size_t nbytes)
76 _DIAGASSERT(cookie != NULL);
79 p = (struct fmemopen_cookie *)cookie;
103 fmemopen_flush(void *cookie)
107 _DIAGASSERT(cookie != NULL);
109 p = (struct fmemopen_cookie *)cookie;
118 fmemopen_seek(void *cookie, off_t offset, int whence)
122 _DIAGASSERT(cookie != NULL);
124 p = (struct fmemopen_cookie *)cookie;
147 fmemopen_close0(void *cookie)
149 _DIAGASSERT(cookie != NULL);
151 free(cookie);
157 fmemopen_close1(void *cookie)
161 _DIAGASSERT(cookie != NULL);
163 p = (struct fmemopen_cookie *)cookie;
176 struct fmemopen_cookie *cookie;
193 cookie = malloc(sizeof(*cookie));
194 if (cookie == NULL)
198 cookie->head = malloc(size);
199 if (cookie->head == NULL) {
200 free(cookie);
203 *cookie->head = '\0';
206 cookie->head = (char *)buf;
208 *cookie->head = '\0';
212 cookie->tail = cookie->head + size;
213 cookie->eob = cookie->head;
215 if (*cookie->eob == '\0')
217 ++cookie->eob;
220 cookie->cur = (oflags & O_APPEND) ? cookie->eob : cookie->head;
229 fp->_cookie = (void *)cookie;