file: update fx_array usage

This commit is contained in:
2026-05-24 20:14:51 +01:00
parent ca8533334b
commit e829c77297
+4 -2
View File
@@ -27,13 +27,15 @@ static enum bshell_status get_row(
size_t *nr_read) size_t *nr_read)
{ {
struct file *f = (struct file *)src; struct file *f = (struct file *)src;
size_t nr_rows = fx_array_size(f->f_lines); size_t nr_rows = fx_array_get_size(f->f_lines);
if (row > nr_rows) { if (row > nr_rows) {
return BSHELL_ERR_EOF; return BSHELL_ERR_EOF;
} }
fx_string *line = fx_array_at(f->f_lines, row - 1); fx_value *line_v = fx_array_get_ref(f->f_lines, row - 1);
fx_string *line = NULL;
fx_value_get_object(line_v, &line);
const char *line_str = fx_string_get_cstr(line); const char *line_str = fx_string_get_cstr(line);
size_t line_len = fx_string_get_size(line, FX_STRLEN_NORMAL); size_t line_len = fx_string_get_size(line, FX_STRLEN_NORMAL);