#include "ccanlint.h"
#include "get_file_lines.h"
#include <talloc/talloc.h>
-#include <string/string.h>
+#include <str/str.h>
+#include <str_talloc/str_talloc.h>
+#include <grab_file/grab_file.h>
#include <noerr/noerr.h>
#include <unistd.h>
#include <sys/types.h>
char **get_ccan_file_lines(struct ccan_file *f)
{
- if (!f->lines)
- f->lines = get_file_lines(f, f->name, &f->num_lines);
+ if (!f->lines) {
+ char *buffer = grab_file(f, f->name, NULL);
+ if (!buffer)
+ err(1, "Getting file %s", f->name);
+ f->lines = strsplit(f, buffer, "\n", &f->num_lines);
+ }
return f->lines;
}