4 Commits

4 changed files with 30 additions and 4 deletions
-1
View File
@@ -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);
+21 -1
View File
@@ -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,6 +61,10 @@ 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
@@ -65,7 +81,7 @@ enum fx_status fx_iterator_move_next(const fx_iterator *it)
const fx_value *fx_iterator_get_value(const fx_iterator *it)
{
if (fx_iterator_get_status(it) != FX_SUCCESS) {
if (!it) {
return NULL;
}
@@ -79,6 +95,10 @@ 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
+8 -1
View File
@@ -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
View File
@@ -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;