Lines Matching defs:fp
57 __slbexpand(FILE *fp, size_t newsize)
64 if (fp->_lb._size >= newsize)
70 if ((p = realloc(fp->_lb._base, newsize)) == NULL)
72 fp->_lb._base = p;
73 fp->_lb._size = newsize;
85 fgetln(FILE *fp, size_t *lenp)
92 FLOCKFILE_CANCELSAFE(fp);
93 ORIENT(fp, -1);
95 if (fp->_r <= 0 && __srefill(fp)) {
102 if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) != NULL) {
109 ret = (char *)fp->_p;
110 *lenp = len = p - fp->_p;
111 fp->_flags |= __SMOD;
112 fp->_r -= len;
113 fp->_p = p;
127 for (len = fp->_r, off = 0;; len += fp->_r) {
135 if (__slbexpand(fp, len + OPTIMISTIC))
137 (void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
140 if (__srefill(fp)) {
141 if (__sfeof(fp))
145 if ((p = memchr((void *)fp->_p, '\n', (size_t)fp->_r)) == NULL)
150 diff = p - fp->_p;
152 if (__slbexpand(fp, len))
154 (void)memcpy((void *)(fp->_lb._base + off), (void *)fp->_p,
156 fp->_r -= diff;
157 fp->_p = p;
162 fp->_lb._base[len] = '\0';
164 ret = (char *)fp->_lb._base;
171 fp->_flags |= __SERR;