root = json_pack("{s:o}", "val", root);
if (expr->timeout)
- json_object_set_new(root, "elem_timeout",
+ json_object_set_new(root, "timeout",
json_integer(expr->timeout / 1000));
if (expr->expiration)
- json_object_set_new(root, "elem_expires",
+ json_object_set_new(root, "expires",
json_integer(expr->expiration / 1000));
if (expr->comment)
- json_object_set_new(root, "elem_comment",
+ json_object_set_new(root, "comment",
json_string(expr->comment));
return json_pack("{s:o}", "elem", root);
}
expr = set_elem_expr_alloc(int_loc, expr);
- if (!json_unpack(root, "{s:i}", "elem_timeout", &i))
+ if (!json_unpack(root, "{s:i}", "timeout", &i))
expr->timeout = i * 1000;
- if (!json_unpack(root, "{s:i}", "elem_expires", &i))
+ if (!json_unpack(root, "{s:i}", "expires", &i))
expr->expiration = i * 1000;
- if (!json_unpack(root, "{s:s}", "elem_comment", &expr->comment))
+ if (!json_unpack(root, "{s:s}", "comment", &expr->comment))
expr->comment = xstrdup(expr->comment);
return expr;
{
struct expr *expr = json_parse_flagged_expr(ctx, CTX_F_SES, root);
- if (expr->ops->type != EXPR_SET_ELEM)
+ if (expr && expr->ops->type != EXPR_SET_ELEM)
expr = set_elem_expr_alloc(int_loc, expr);
return expr;
struct expr *expr, *expr2;
struct stmt *stmt;
json_t *elem;
- uint64_t tmp;
int op;
if (json_unpack_err(ctx, value, "{s:s, s:o, s:s}",
return NULL;
}
- if (!json_unpack(elem, "{s:I}", "elem_timeout", &tmp))
- expr->timeout = tmp * 1000;
- if (!json_unpack(elem, "{s:I}", "elem_expires", &tmp))
- expr->expiration = tmp * 1000;
- json_unpack(elem, "{s:s}", "elem_comment", &expr->comment);
-
if (set[0] != '@') {
json_error(ctx, "Illegal set reference in set statement.");
expr_free(expr);