Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 20dc844c9d | |||
| 93ecd02b3f | |||
| 612ba7101d | |||
| fb864a64c9 |
@@ -1852,7 +1852,6 @@ static fx_result parse_array_inline(struct ctx *ctx, fx_value *result)
|
||||
|
||||
static fx_result parse_value(struct ctx *ctx, fx_value *result)
|
||||
{
|
||||
|
||||
struct token *tok = peek_token(ctx);
|
||||
if (!tok) {
|
||||
return FX_RESULT_ERR(BAD_FORMAT);
|
||||
|
||||
+28
-6
@@ -25,6 +25,10 @@ static enum fx_status iterator_set_status(
|
||||
|
||||
const fx_iterator *fx_iterator_begin(const fx_iterable *it)
|
||||
{
|
||||
if (!it) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FX_CLASS_DISPATCH_VIRTUAL_0(
|
||||
fx_iterable,
|
||||
FX_TYPE_ITERABLE,
|
||||
@@ -35,11 +39,19 @@ const fx_iterator *fx_iterator_begin(const fx_iterable *it)
|
||||
|
||||
enum fx_status fx_iterator_get_status(const fx_iterator *it)
|
||||
{
|
||||
if (!it) {
|
||||
return FX_ERR_NO_DATA;
|
||||
}
|
||||
|
||||
FX_CLASS_DISPATCH_STATIC_0(FX_TYPE_ITERATOR, iterator_get_status, it);
|
||||
}
|
||||
|
||||
enum fx_status fx_iterator_set_status(const fx_iterator *it, fx_status status)
|
||||
{
|
||||
if (!it) {
|
||||
return FX_ERR_NO_DATA;
|
||||
}
|
||||
|
||||
FX_CLASS_DISPATCH_STATIC(
|
||||
FX_TYPE_ITERATOR,
|
||||
iterator_set_status,
|
||||
@@ -49,11 +61,14 @@ enum fx_status fx_iterator_set_status(const fx_iterator *it, fx_status status)
|
||||
|
||||
enum fx_status fx_iterator_move_next(const fx_iterator *it)
|
||||
{
|
||||
if (!it) {
|
||||
return FX_ERR_NO_DATA;
|
||||
}
|
||||
|
||||
enum fx_status status = FX_ERR_NOT_SUPPORTED;
|
||||
|
||||
fx_iterator_class *iface = fx_object_get_interface(
|
||||
it,
|
||||
FX_TYPE_ITERATOR);
|
||||
fx_iterator_class *iface
|
||||
= fx_object_get_interface(it, FX_TYPE_ITERATOR);
|
||||
if (iface && iface->it_move_next) {
|
||||
status = iface->it_move_next(it);
|
||||
}
|
||||
@@ -66,6 +81,10 @@ enum fx_status fx_iterator_move_next(const fx_iterator *it)
|
||||
|
||||
const fx_value *fx_iterator_get_value(const fx_iterator *it)
|
||||
{
|
||||
if (!it) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FX_CLASS_DISPATCH_VIRTUAL_0(
|
||||
fx_iterator,
|
||||
FX_TYPE_ITERATOR,
|
||||
@@ -76,11 +95,14 @@ const fx_value *fx_iterator_get_value(const fx_iterator *it)
|
||||
|
||||
fx_status fx_iterator_erase(fx_iterator *it)
|
||||
{
|
||||
if (!it) {
|
||||
return FX_ERR_NO_DATA;
|
||||
}
|
||||
|
||||
enum fx_status status = FX_ERR_NOT_SUPPORTED;
|
||||
|
||||
fx_iterator_class *iface = fx_object_get_interface(
|
||||
it,
|
||||
FX_TYPE_ITERATOR);
|
||||
fx_iterator_class *iface
|
||||
= fx_object_get_interface(it, FX_TYPE_ITERATOR);
|
||||
if (iface && iface->it_erase) {
|
||||
status = iface->it_erase(it);
|
||||
}
|
||||
|
||||
+8
-1
@@ -200,12 +200,19 @@ enum fx_status fx_object_get_data(
|
||||
|
||||
struct _fx_object *fx_object_ref(struct _fx_object *p)
|
||||
{
|
||||
p->obj_ref++;
|
||||
if (p) {
|
||||
p->obj_ref++;
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void fx_object_unref(struct _fx_object *p)
|
||||
{
|
||||
if (!p) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->obj_ref > 1) {
|
||||
p->obj_ref--;
|
||||
return;
|
||||
|
||||
+1
-1
@@ -301,7 +301,7 @@ static fx_string *string_duplicate(const struct fx_string_p *str)
|
||||
const char *src = string_ptr(str);
|
||||
char *dst = string_ptr(new_str_p);
|
||||
|
||||
memcpy(dst, src, str->s_len);
|
||||
memcpy(dst, src, str->s_len + 1);
|
||||
new_str_p->s_len = str->s_len;
|
||||
new_str_p->s_codepoints = str->s_codepoints;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user