1 #include "stdio_impl.h"
7 ssize_t
getdelim(char **restrict s
, size_t *restrict n
, int delim
, FILE *restrict f
)
28 if (f
->rpos
!= f
->rend
) {
29 z
= memchr(f
->rpos
, delim
, f
->rend
- f
->rpos
);
30 k
= z
? z
- f
->rpos
+ 1 : f
->rend
- f
->rpos
;
36 if (k
>= SIZE_MAX
/2-i
) goto oom
;
38 if (!z
&& m
< SIZE_MAX
/4) m
+= m
/2;
48 memcpy(*s
+i
, f
->rpos
, k
);
52 if ((c
= getc_unlocked(f
)) == EOF
) {
59 if (((*s
)[i
++] = c
) == delim
) break;
74 weak_alias(getdelim
, __getdelim
);