Skip to content

Commit

Permalink
plugins exts UPDATE require ext storage to be a pointer
Browse files Browse the repository at this point in the history
There are no other use-cases anyway and it being
a uint64_t number causes issues on 32b platforms.
  • Loading branch information
michalvasko committed Sep 5, 2024
1 parent ffe012b commit a6bab1e
Show file tree
Hide file tree
Showing 15 changed files with 192 additions and 195 deletions.
2 changes: 1 addition & 1 deletion src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ ly_ctx_unset_options(struct ly_ctx *ctx, uint16_t option)
ext = &mod->compiled->exts[u];
LY_ARRAY_FOR(ext->substmts, v) {
if (ext->substmts[v].stmt & LY_STMT_DATA_NODE_MASK) {
LY_LIST_FOR(*VOIDPTR2_C(ext->substmts[v].storage), root) {
LY_LIST_FOR(*ext->substmts[v].storage_p, root) {
lysc_tree_dfs_full(root, lysc_node_clear_priv_dfs_cb, NULL);
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/ly_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ struct lysc_node;
#define GETMACRO6(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define GETMACRO7(_1, _2, _3, _4, _5, _6, _7, NAME, ...) NAME

#define VOIDPTR_C(var) ((void *)(uintptr_t)(var))
#define VOIDPTR2_C(var) ((void **)(uintptr_t)(var))

/******************************************************************************
* Logger
*****************************************************************************/
Expand Down
22 changes: 11 additions & 11 deletions src/parser_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3559,7 +3559,7 @@ lys_parse_ext_instance_stmt(struct lysp_ctx *pctx, struct lysp_ext_substmt *subs
{
LY_ERR rc = LY_SUCCESS;

if (!substmt->storage) {
if (!substmt->storage_p) {
/* nothing to parse, ignored */
goto cleanup;
}
Expand Down Expand Up @@ -3587,7 +3587,7 @@ lys_parse_ext_instance_stmt(struct lysp_ctx *pctx, struct lysp_ext_substmt *subs
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, (void **)&pnode, NULL), cleanup);

/* usually is a linked-list of all the parsed schema nodes */
pnodes_p = VOIDPTR_C(substmt->storage);
pnodes_p = (struct lysp_node **)substmt->storage_p;
while (*pnodes_p) {
pnodes_p = &(*pnodes_p)->next;
}
Expand Down Expand Up @@ -3615,7 +3615,7 @@ lys_parse_ext_instance_stmt(struct lysp_ctx *pctx, struct lysp_ext_substmt *subs
case LY_STMT_TYPEDEF:
case LY_STMT_UNIQUE:
/* parse, sized array */
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
break;

case LY_STMT_ARGUMENT:
Expand Down Expand Up @@ -3650,50 +3650,50 @@ lys_parse_ext_instance_stmt(struct lysp_ctx *pctx, struct lysp_ext_substmt *subs
case LY_STMT_YANG_VERSION:
case LY_STMT_YIN_ELEMENT:
/* single item */
if (*VOIDPTR2_C(substmt->storage)) {
if (*substmt->storage_p) {
LOGVAL(PARSER_CTX(pctx), LY_VCODE_DUPSTMT, stmt->stmt);
rc = LY_EVALID;
goto cleanup;
}

/* parse */
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
break;

case LY_STMT_CONFIG:
/* single item */
if ((*(uint16_t *)VOIDPTR2_C(substmt->storage)) & LYS_CONFIG_MASK) {
if ((*(uint16_t *)substmt->storage_p) & LYS_CONFIG_MASK) {
LOGVAL(PARSER_CTX(pctx), LY_VCODE_DUPSTMT, stmt->stmt);
rc = LY_EVALID;
goto cleanup;
}

/* parse */
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
break;

case LY_STMT_ORDERED_BY:
/* single item */
if ((*(uint16_t *)VOIDPTR2_C(substmt->storage)) & LYS_ORDBY_MASK) {
if ((*(uint16_t *)substmt->storage_p) & LYS_ORDBY_MASK) {
LOGVAL(PARSER_CTX(pctx), LY_VCODE_DUPSTMT, stmt->stmt);
rc = LY_EVALID;
goto cleanup;
}

/* parse */
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
break;

case LY_STMT_STATUS:
/* single item */
if ((*(uint16_t *)VOIDPTR2_C(substmt->storage)) & LYS_STATUS_MASK) {
if ((*(uint16_t *)substmt->storage_p) & LYS_STATUS_MASK) {
LOGVAL(PARSER_CTX(pctx), LY_VCODE_DUPSTMT, stmt->stmt);
rc = LY_EVALID;
goto cleanup;
}

/* parse */
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, VOIDPTR_C(substmt->storage), NULL), cleanup);
LY_CHECK_GOTO(rc = lysp_stmt_parse(pctx, stmt, substmt->storage_p, NULL), cleanup);
break;

default:
Expand Down
Loading

0 comments on commit a6bab1e

Please sign in to comment.