From: David Lamparter Date: Sun, 21 Jul 2024 01:29:11 +0000 (-0700) Subject: lib/clippy: expose JOIN_TKN's fork node X-Git-Tag: base_10.2~220^2~4 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e2344206ca26169bbc64b16a838856253013c1df;p=matthieu%2Ffrr.git 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 --- 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" }, {} };