fx.io: fix linux compilation
This commit is contained in:
@@ -37,6 +37,7 @@ struct fx_directory_iterator_p {
|
||||
fx_directory *root;
|
||||
|
||||
fx_directory_entry entry;
|
||||
fx_value entry_value;
|
||||
};
|
||||
|
||||
/*** PRIVATE FUNCTIONS ********************************************************/
|
||||
@@ -510,6 +511,8 @@ static void update_iterator_data(struct fx_directory_iterator_p *it)
|
||||
fx_path *path = fx_path_create_from_cstr(
|
||||
ent->fts_path + fx_path_length(it->_p->d_path_abs) + 1);
|
||||
|
||||
fx_value_unset(&it->entry_value);
|
||||
it->entry_value = FX_POINTER(&it->entry);
|
||||
it->entry.filename = ent->fts_name;
|
||||
it->entry.filepath = path;
|
||||
|
||||
@@ -616,12 +619,7 @@ fx_iterator *fx_directory_begin(
|
||||
return it_obj;
|
||||
}
|
||||
|
||||
static fx_iterator *iterator_begin(fx_object *obj)
|
||||
{
|
||||
return fx_directory_begin(obj, FX_DIRECTORY_ITERATE_PARENT_FIRST);
|
||||
}
|
||||
|
||||
static const fx_iterator *iterator_cbegin(const fx_object *obj)
|
||||
static const fx_iterator *iterator_begin(const fx_object *obj)
|
||||
{
|
||||
return fx_directory_begin(
|
||||
(fx_object *)obj,
|
||||
@@ -692,20 +690,12 @@ static enum fx_status iterator_erase(fx_iterator *obj)
|
||||
return iterator_move_next(obj);
|
||||
}
|
||||
|
||||
static fx_iterator_value iterator_get_value(fx_iterator *obj)
|
||||
static const fx_value *iterator_get_value(const fx_iterator *obj)
|
||||
{
|
||||
struct fx_directory_iterator_p *it
|
||||
= fx_object_get_private(obj, FX_TYPE_DIRECTORY_ITERATOR);
|
||||
|
||||
return FX_ITERATOR_VALUE_PTR(&it->entry);
|
||||
}
|
||||
|
||||
static const fx_iterator_value iterator_get_cvalue(const fx_iterator *obj)
|
||||
{
|
||||
struct fx_directory_iterator_p *it
|
||||
= fx_object_get_private(obj, FX_TYPE_DIRECTORY_ITERATOR);
|
||||
|
||||
return FX_ITERATOR_VALUE_CPTR(&it->entry);
|
||||
return &it->entry_value;
|
||||
}
|
||||
|
||||
/*** CLASS DEFINITION *********************************************************/
|
||||
@@ -718,7 +708,6 @@ FX_TYPE_CLASS_BEGIN(fx_directory)
|
||||
|
||||
FX_TYPE_VTABLE_INTERFACE_BEGIN(fx_iterable, FX_TYPE_ITERABLE)
|
||||
FX_INTERFACE_ENTRY(it_begin) = iterator_begin;
|
||||
FX_INTERFACE_ENTRY(it_cbegin) = iterator_cbegin;
|
||||
FX_TYPE_VTABLE_INTERFACE_END(fx_iterable, FX_TYPE_ITERABLE)
|
||||
FX_TYPE_CLASS_END(fx_directory)
|
||||
|
||||
@@ -741,7 +730,6 @@ FX_TYPE_CLASS_BEGIN(fx_directory_iterator)
|
||||
FX_INTERFACE_ENTRY(it_move_next) = iterator_move_next;
|
||||
FX_INTERFACE_ENTRY(it_erase) = iterator_erase;
|
||||
FX_INTERFACE_ENTRY(it_get_value) = iterator_get_value;
|
||||
FX_INTERFACE_ENTRY(it_get_cvalue) = iterator_get_cvalue;
|
||||
FX_TYPE_VTABLE_INTERFACE_END(fx_iterator, FX_TYPE_ITERATOR)
|
||||
FX_TYPE_CLASS_END(fx_directory_iterator)
|
||||
|
||||
|
||||
+10
-3
@@ -392,11 +392,18 @@ void path_fini(fx_object *obj, void *priv)
|
||||
fx_string_unref(path->p_pathstr);
|
||||
}
|
||||
|
||||
void path_to_string(const fx_object *obj, fx_stream *out)
|
||||
static fx_status path_to_string(
|
||||
const fx_value *obj,
|
||||
fx_stream *out,
|
||||
const char *format)
|
||||
{
|
||||
struct fx_path_p *path = fx_object_get_private(obj, FX_TYPE_PATH);
|
||||
struct fx_path_p *path
|
||||
= fx_object_get_private(obj->v_object, FX_TYPE_PATH);
|
||||
|
||||
fx_stream_write_cstr(out, fx_string_get_cstr(path->p_pathstr), NULL);
|
||||
return fx_stream_write_cstr(
|
||||
out,
|
||||
fx_string_get_cstr(path->p_pathstr),
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*** CLASS DEFINITION *********************************************************/
|
||||
|
||||
Reference in New Issue
Block a user