Lines Matching refs:cookie
55 fmemopen_read(void *cookie, char *buf, int nbytes) in fmemopen_read() argument
61 assert(cookie != NULL); in fmemopen_read()
64 p = cookie; in fmemopen_read()
74 fmemopen_write(void *cookie, const char *buf, int nbytes) in fmemopen_write() argument
80 assert(cookie != NULL); in fmemopen_write()
83 p = cookie; in fmemopen_write()
108 fmemopen_seek(void *cookie, fpos_t offset, int whence) in fmemopen_seek() argument
112 assert(cookie != NULL); in fmemopen_seek()
114 p = (struct fmemopen_cookie *)cookie; in fmemopen_seek()
137 fmemopen_close0(void *cookie) in fmemopen_close0() argument
139 assert(cookie != NULL); in fmemopen_close0()
141 free(cookie); in fmemopen_close0()
147 fmemopen_close1(void *cookie) in fmemopen_close1() argument
151 assert(cookie != NULL); in fmemopen_close1()
153 p = cookie; in fmemopen_close1()
166 struct fmemopen_cookie *cookie; in fmemopen() local
182 cookie = malloc(sizeof(*cookie)); in fmemopen()
183 if (cookie == NULL) in fmemopen()
187 cookie->head = malloc(size); in fmemopen()
188 if (cookie->head == NULL) { in fmemopen()
189 free(cookie); in fmemopen()
192 *cookie->head = '\0'; in fmemopen()
195 cookie->head = (char *)buf; in fmemopen()
197 *cookie->head = '\0'; in fmemopen()
201 cookie->tail = cookie->head + size; in fmemopen()
202 cookie->eob = cookie->head; in fmemopen()
204 if (*cookie->eob == '\0') in fmemopen()
206 ++cookie->eob; in fmemopen()
209 cookie->cur = (oflags & O_APPEND) ? cookie->eob : cookie->head; in fmemopen()
215 fp->_cookie = (void *)cookie; in fmemopen()