diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/readline.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/readline.c b/common/readline.c index 4f55e99c..46b96623 100644 --- a/common/readline.c +++ b/common/readline.c | |||
@@ -49,11 +49,11 @@ char *read_line(FILE *file) { | |||
49 | return string; | 49 | return string; |
50 | } | 50 | } |
51 | 51 | ||
52 | char *peek_line(FILE *file, int offset, long *position) { | 52 | char *peek_line(FILE *file, int line_offset, long *position) { |
53 | long pos = ftell(file); | 53 | long pos = ftell(file); |
54 | size_t length = 1; | 54 | size_t length = 0; |
55 | char *line = calloc(1, length); | 55 | char *line = NULL; |
56 | for (int i = 0; i <= offset; i++) { | 56 | for (int i = 0; i <= line_offset; i++) { |
57 | ssize_t read = getline(&line, &length, file); | 57 | ssize_t read = getline(&line, &length, file); |
58 | if (read < 0) { | 58 | if (read < 0) { |
59 | break; | 59 | break; |