aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2018-11-30 16:46:39 -0800
committerRob Landley <rob@landley.net>2018-11-30 20:41:19 -0600
commit428df7d7743859538361f2b2beb3c98aaddd1d38 (patch)
treeff0e9d10b7feeaba820c0d8f1e41057e3816ec14 /lib
parent2c859218d74bf9a3b69fd54948139cf08d9881a4 (diff)
downloadtoybox-428df7d7743859538361f2b2beb3c98aaddd1d38.tar.gz
macOS: remove unnecessary <stdio.h> workarounds.
These were added in macOS 10.7 in 2011-07, so the seven year rule applies...
Diffstat (limited to 'lib')
-rw-r--r--lib/portability.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/portability.c b/lib/portability.c
index 2ba3d29f..b9d65bab 100644
--- a/lib/portability.c
+++ b/lib/portability.c
@@ -45,58 +45,6 @@ void xgetrandom(void *buf, unsigned buflen, unsigned flags)
}
#if defined(__APPLE__)
-ssize_t getdelim(char **linep, size_t *np, int delim, FILE *stream)
-{
- int ch;
- size_t new_len;
- ssize_t i = 0;
- char *line, *new_line;
-
- // Invalid input
- if (!linep || !np) {
- errno = EINVAL;
- return -1;
- }
-
- if (*linep == NULL || *np == 0) {
- *np = 1024;
- *linep = calloc(1, *np);
- if (*linep == NULL) return -1;
- }
- line = *linep;
-
- while ((ch = getc(stream)) != EOF) {
- if (i > *np) {
- // Need more space
- new_len = *np + 1024;
- new_line = realloc(*linep, new_len);
- if (!new_line) return -1;
- *np = new_len;
- line = *linep = new_line;
- }
-
- line[i++] = ch;
- if (ch == delim) break;
- }
-
- if (i > *np) {
- // Need more space
- new_len = i + 2;
- new_line = realloc(*linep, new_len);
- if (!new_line) return -1;
- *np = new_len;
- line = *linep = new_line;
- }
- line[i] = '\0';
-
- return i > 0 ? i : -1;
-}
-
-ssize_t getline(char **linep, size_t *np, FILE *stream)
-{
- return getdelim(linep, np, '\n', stream);
-}
-
extern char **environ;
int clearenv(void)