about summary refs log tree commit diff stats
path: root/ignore.c
diff options
context:
space:
mode:
authorRory Bradford <roryrjb@gmail.com>2022-06-05 12:13:36 +0100
committerRory Bradford <roryrjb@gmail.com>2022-06-05 12:20:04 +0100
commit21b89ad57984a5caae0374fee3ee69dcdaf480e2 (patch)
tree555940d65cc10745d8ed858fb4f4a1e2c4766513 /ignore.c
parent0e5b784369d18467ced409c204e0f2191646e309 (diff)
downloadrf-21b89ad57984a5caae0374fee3ee69dcdaf480e2.tar.gz
Use fgets instead of getline.
Signed-off-by: Rory Bradford <roryrjb@gmail.com>
Diffstat (limited to 'ignore.c')
-rw-r--r--ignore.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/ignore.c b/ignore.c
index c247692..d859d46 100644
--- a/ignore.c
+++ b/ignore.c
@@ -6,6 +6,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "rf.h"
 #include "ignore.h"
 
 static int total_size;
@@ -18,15 +19,14 @@ struct ignores *init_ignores(char *path) {
 		return NULL;
 	}
 
-	char *line = NULL;
-	size_t llen = 0;
+	char line[MAX_PATH_LENGTH];
 	total_size = IGNORE_SIZE;
 	struct ignores *ignores =
 		(struct ignores *)calloc(sizeof(struct ignores), 1);
 	ignores->list = (char **)calloc(sizeof(char *), IGNORE_SIZE);
 	ignores->size = 0;
 
-	while (getline(&line, &llen, ignore) != -1) {
+	while (fgets(line, MAX_PATH_LENGTH, ignore) != NULL) {
 		/** isspace doesn't necessarily hold true for `\n` for anything
 		 * other than the 'C' locale on some platforms, so we have to do
 		 * an additional check for this
@@ -64,7 +64,6 @@ struct ignores *init_ignores(char *path) {
 		}
 	}
 
-	free(line);
 	fclose(ignore);
 
 	ignores->size = i;