diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-11 22:28:43 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-11 22:28:43 -0400 |
| commit | 3443edf760bd4d53aafb2079f7ab67d98ee5013e (patch) | |
| tree | ec7d77db2a266d27cfb19ad30f4892e84ed2593b /builtins/path.c | |
| parent | f7ff82913fccde369fcbc666100570e7cad066db (diff) | |
Use optionals for iterators
Diffstat (limited to 'builtins/path.c')
| -rw-r--r-- | builtins/path.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/builtins/path.c b/builtins/path.c index ab032927..8864b7de 100644 --- a/builtins/path.c +++ b/builtins/path.c @@ -16,7 +16,7 @@ #include "files.h" #include "functions.h" #include "integers.h" -#include "nextline.h" +#include "optionals.h" #include "path.h" #include "text.h" #include "types.h" @@ -433,16 +433,16 @@ static void _line_reader_cleanup(FILE **f) } } -static NextLine_t _next_line(FILE **f) +static Text_t _next_line(FILE **f) { - if (!f || !*f) return (NextLine_t){NextLine$tag$Done}; + if (!f || !*f) return NULL_TEXT; char *line = NULL; size_t size = 0; ssize_t len = getline(&line, &size, *f); if (len <= 0) { _line_reader_cleanup(f); - return (NextLine_t){NextLine$tag$Done}; + return NULL_TEXT; } while (len > 0 && (line[len-1] == '\r' || line[len-1] == '\n')) @@ -453,7 +453,7 @@ static NextLine_t _next_line(FILE **f) Text_t line_text = Text$format("%.*s", len, line); free(line); - return NextLine$tagged$Next(line_text); + return line_text; } public Closure_t Path$by_line(Path_t path) |
