meta: replace bluelib with fx
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <blue/ds/array.h>
|
||||
#include <blue/ds/string.h>
|
||||
#include <fx/ds/array.h>
|
||||
#include <fx/ds/string.h>
|
||||
#include <errno.h>
|
||||
#include <ivy/file.h>
|
||||
#include <stdlib.h>
|
||||
@@ -18,17 +18,17 @@ static enum ivy_status get_row(
|
||||
size_t *nr_read)
|
||||
{
|
||||
struct ivy_file *f = (struct ivy_file *)src;
|
||||
size_t nr_rows = b_array_size(f->f_lines);
|
||||
size_t nr_rows = fx_array_size(f->f_lines);
|
||||
|
||||
if (row > nr_rows) {
|
||||
return IVY_ERR_EOF;
|
||||
}
|
||||
|
||||
b_string *line = b_array_at(f->f_lines, row - 1);
|
||||
fx_string *line = fx_array_at(f->f_lines, row - 1);
|
||||
|
||||
const char *line_str = b_string_ptr(line);
|
||||
size_t line_len = b_string_get_size(line, B_STRLEN_NORMAL);
|
||||
size_t copy_len = b_min(ulong, count, line_len);
|
||||
const char *line_str = fx_string_ptr(line);
|
||||
size_t line_len = fx_string_get_size(line, FX_STRLEN_NORMAL);
|
||||
size_t copy_len = fx_min(ulong, count, line_len);
|
||||
|
||||
memcpy(buf, line_str, copy_len);
|
||||
buf[copy_len] = 0;
|
||||
@@ -52,9 +52,9 @@ static enum ivy_status readline(
|
||||
return feof(f->f_fp) ? IVY_ERR_EOF : IVY_ERR_IO_FAILURE;
|
||||
}
|
||||
|
||||
b_string *line_str = b_string_create_from_cstr(buf);
|
||||
b_array_append(f->f_lines, B_OBJECT(line_str));
|
||||
b_string_unref(line_str);
|
||||
fx_string *line_str = fx_string_create_from_cstr(buf);
|
||||
fx_array_append(f->f_lines, FX_OBJECT(line_str));
|
||||
fx_string_unref(line_str);
|
||||
|
||||
*nr_read = strlen(buf);
|
||||
return IVY_OK;
|
||||
@@ -79,8 +79,8 @@ enum ivy_status ivy_file_open(const char *path, struct ivy_file **out)
|
||||
file->f_base.s_get_row = get_row;
|
||||
file->f_base.s_readline = readline;
|
||||
file->f_fp = fp;
|
||||
file->f_path = b_strdup(path);
|
||||
file->f_lines = b_array_create();
|
||||
file->f_path = fx_strdup(path);
|
||||
file->f_lines = fx_array_create();
|
||||
|
||||
*out = file;
|
||||
|
||||
@@ -89,7 +89,7 @@ enum ivy_status ivy_file_open(const char *path, struct ivy_file **out)
|
||||
|
||||
void ivy_file_close(struct ivy_file *file)
|
||||
{
|
||||
b_array_unref(file->f_lines);
|
||||
fx_array_unref(file->f_lines);
|
||||
free(file->f_path);
|
||||
fclose(file->f_fp);
|
||||
free(file);
|
||||
|
||||
Reference in New Issue
Block a user