aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2018-06-01 18:35:16 -0400
committerBrian Ashworth <bosrsf04@gmail.com>2018-06-02 08:07:44 -0400
commitaf87c7a1af8d790b819afe782fcff2830e959d58 (patch)
treeaf9b6fe9c85e1159679406abe82c2d61fe427705 /common
parentfbca3bbacbe6e223a5e15d8265301b7d2c36af4e (diff)
downloadsway-af87c7a1af8d790b819afe782fcff2830e959d58.tar.xz
Address emersion's feedback on peek_line
Diffstat (limited to 'common')
-rw-r--r--common/readline.c8
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) {
return string;
}
-char *peek_line(FILE *file, int offset, long *position) {
+char *peek_line(FILE *file, int line_offset, long *position) {
long pos = ftell(file);
- size_t length = 1;
- char *line = calloc(1, length);
- for (int i = 0; i <= offset; i++) {
+ size_t length = 0;
+ char *line = NULL;
+ for (int i = 0; i <= line_offset; i++) {
ssize_t read = getline(&line, &length, file);
if (read < 0) {
break;