diff options
| author | David Lamparter <equinox@opensourcerouting.org> | 2024-07-20 18:29:11 -0700 |
|---|---|---|
| committer | Donald Sharp <sharpd@nvidia.com> | 2024-07-31 08:08:53 -0400 |
| commit | e2344206ca26169bbc64b16a838856253013c1df (patch) | |
| tree | f9757178e728bcef0321241ed557b5598713db23 /lib/command_py.c | |
| parent | 3c1556f386a6c5866e1b5352571e44ed3e22da76 (diff) | |
lib/clippy: expose JOIN_TKN's fork node
FORK_TKN's join node is already exposed, mirror to expose JOIN_TKN's
fork node.
(contains minor cleanup to make checkpatch.pl shut up)
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/command_py.c')
| -rw-r--r-- | lib/command_py.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/command_py.c b/lib/command_py.c index 411caa52d6..99438d4f5a 100644 --- a/lib/command_py.c +++ b/lib/command_py.c @@ -138,22 +138,40 @@ static PyObject *graph_node_prev(PyObject *self, PyObject *args) static PyObject *graph_node_join(PyObject *self, PyObject *args) { struct wrap_graph_node *wrap = (struct wrap_graph_node *)self; + struct cmd_token *tok; if (!wrap->node->data || ((struct cmd_token *)wrap->node->data)->type == END_TKN) Py_RETURN_NONE; - struct cmd_token *tok = wrap->node->data; + tok = wrap->node->data; if (tok->type != FORK_TKN) Py_RETURN_NONE; return graph_to_pyobj(wrap->wgraph, tok->forkjoin); }; +static PyObject *graph_node_fork(PyObject *self, PyObject *args) +{ + struct wrap_graph_node *wrap = (struct wrap_graph_node *)self; + struct cmd_token *tok; + + if (!wrap->node->data || + ((struct cmd_token *)wrap->node->data)->type == END_TKN) + Py_RETURN_NONE; + + tok = wrap->node->data; + if (tok->type != JOIN_TKN) + Py_RETURN_NONE; + + return graph_to_pyobj(wrap->wgraph, tok->forkjoin); +}; + static PyMethodDef methods_graph_node[] = { { "next", graph_node_next, METH_NOARGS, "outbound graph edge list" }, { "prev", graph_node_prev, METH_NOARGS, "inbound graph edge list" }, { "join", graph_node_join, METH_NOARGS, "outbound join node" }, + { "fork", graph_node_fork, METH_NOARGS, "inbound fork node" }, {} }; |
