1 #include "stdio_impl.h"
6 #define MIN(a,b) ((a)<(b) ? (a) : (b))
8 ssize_t getdelim(char **restrict s, size_t *restrict n, int delim, FILE *restrict f)
28 z = memchr(f->rpos, delim, f->rend - f->rpos);
29 k = z ? z - f->rpos + 1 : f->rend - f->rpos;
31 if (k >= SIZE_MAX/2-i) goto oom;
33 if (!z && m < SIZE_MAX/4) m += m/2;
43 memcpy(*s+i, f->rpos, k);
47 if ((c = getc_unlocked(f)) == EOF) {
54 if (((*s)[i++] = c) == delim) break;
68 weak_alias(getdelim, __getdelim);