summaryrefslogtreecommitdiff
path: root/checknr/checknr.c
diff options
context:
space:
mode:
Diffstat (limited to 'checknr/checknr.c')
-rw-r--r--checknr/checknr.c34
1 files changed, 1 insertions, 33 deletions
diff --git a/checknr/checknr.c b/checknr/checknr.c
index b7dde0af2004..a98b0adc2d04 100644
--- a/checknr/checknr.c
+++ b/checknr/checknr.c
@@ -179,7 +179,6 @@ static void checkknown(char *mac);
static void addcmd(char *line);
static void addmac(char *mac);
static int binsrch(char *mac);
-static char *fgetline(char **line, size_t *linesize, size_t *llen, FILE *fp);
static void
growstk(void)
@@ -307,7 +306,7 @@ process(FILE *f)
int pl;
stktop = -1;
- for (lineno = 1; fgetline(&line, &linesize, NULL, f); lineno++) {
+ for (lineno = 1; getline(&line, &linesize, f) > 0; lineno++) {
if (line[0] == '.') {
/*
* find and isolate the macro/command name.
@@ -636,34 +635,3 @@ binsrch(char *mac)
slot = bot; /* place it would have gone */
return (-1);
}
-
-#define LSIZE 256
-
-static char *
-fgetline(char **line, size_t *linesize, size_t *llen, FILE *fp)
-{
- int c;
- size_t n = 0;
-
- if (*line == NULL || *linesize < LSIZE + n + 1)
- *line = realloc(*line, *linesize = LSIZE + n + 1);
- for (;;) {
- if (n >= *linesize - LSIZE / 2)
- *line = realloc(*line, *linesize += LSIZE);
- c = getc(fp);
- if (c != EOF) {
- (*line)[n++] = c;
- (*line)[n] = '\0';
- if (c == '\n')
- break;
- } else {
- if (n > 0)
- break;
- else
- return NULL;
- }
- }
- if (llen)
- *llen = n;
- return *line;
-}