diff options
| author | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 20:08:37 +0300 |
|---|---|---|
| committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-10-13 20:12:35 +0300 |
| commit | 2560505196b924f5c447f6c1d493ed9b74a13108 (patch) | |
| tree | 515278e4362bf4f9c9418168df90a90b74946c20 /lib/filter_cli.c | |
| parent | d7374bd3b1be5edfc20534ae5a301a0160c017bf (diff) | |
lib: northbound cli show/cmd functions must not modify data nodes
To ensure this, add a const modifier to functions' arguments. Would be
great do this initially and avoid this large code change, but better
late than never.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/filter_cli.c')
| -rw-r--r-- | lib/filter_cli.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/filter_cli.c b/lib/filter_cli.c index 45c7544a3b..58297b1835 100644 --- a/lib/filter_cli.c +++ b/lib/filter_cli.c @@ -1015,7 +1015,8 @@ ALIAS( ACCESS_LIST_REMARK_STR ACCESS_LIST_REMARK_LINE_STR) -int access_list_cmp(struct lyd_node *dnode1, struct lyd_node *dnode2) +int access_list_cmp(const struct lyd_node *dnode1, + const struct lyd_node *dnode2) { uint32_t seq1 = yang_dnode_get_uint32(dnode1, "./sequence"); uint32_t seq2 = yang_dnode_get_uint32(dnode2, "./sequence"); @@ -1023,7 +1024,7 @@ int access_list_cmp(struct lyd_node *dnode1, struct lyd_node *dnode2) return seq1 - seq2; } -void access_list_show(struct vty *vty, struct lyd_node *dnode, +void access_list_show(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { int type = yang_dnode_get_enum(dnode, "../type"); @@ -1137,7 +1138,7 @@ void access_list_show(struct vty *vty, struct lyd_node *dnode, vty_out(vty, "\n"); } -void access_list_remark_show(struct vty *vty, struct lyd_node *dnode, +void access_list_remark_show(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { int type = yang_dnode_get_enum(dnode, "../type"); @@ -1658,7 +1659,8 @@ ALIAS( ACCESS_LIST_REMARK_STR ACCESS_LIST_REMARK_LINE_STR) -int prefix_list_cmp(struct lyd_node *dnode1, struct lyd_node *dnode2) +int prefix_list_cmp(const struct lyd_node *dnode1, + const struct lyd_node *dnode2) { uint32_t seq1 = yang_dnode_get_uint32(dnode1, "./sequence"); uint32_t seq2 = yang_dnode_get_uint32(dnode2, "./sequence"); @@ -1666,7 +1668,7 @@ int prefix_list_cmp(struct lyd_node *dnode1, struct lyd_node *dnode2) return seq1 - seq2; } -void prefix_list_show(struct vty *vty, struct lyd_node *dnode, +void prefix_list_show(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { int type = yang_dnode_get_enum(dnode, "../type"); @@ -1725,7 +1727,7 @@ void prefix_list_show(struct vty *vty, struct lyd_node *dnode, vty_out(vty, "\n"); } -void prefix_list_remark_show(struct vty *vty, struct lyd_node *dnode, +void prefix_list_remark_show(struct vty *vty, const struct lyd_node *dnode, bool show_defaults) { int type = yang_dnode_get_enum(dnode, "../type"); |
