mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 21:57:36 +00:00
lib/clippy: wrap cmd_graph_merge via Graph.merge()
Export cmd_graph_merge() to python code via graph1.merge(graph2). Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
This commit is contained in:
parent
7fb8729a32
commit
34a4f858b7
@ -258,9 +258,13 @@ static PyObject *graph_first(PyObject *self, PyObject *args)
|
|||||||
return graph_to_pyobj(gwrap, gn);
|
return graph_to_pyobj(gwrap, gn);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static PyObject *graph_merge(PyObject *self, PyObject *args);
|
||||||
|
|
||||||
static PyMethodDef methods_graph[] = {
|
static PyMethodDef methods_graph[] = {
|
||||||
{"first", graph_first, METH_NOARGS, "first graph node"},
|
{ "first", graph_first, METH_NOARGS, "first graph node" },
|
||||||
{}};
|
{ "merge", graph_merge, METH_VARARGS, "merge graphs" },
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
static PyObject *graph_parse(PyTypeObject *type, PyObject *args,
|
static PyObject *graph_parse(PyTypeObject *type, PyObject *args,
|
||||||
PyObject *kwds);
|
PyObject *kwds);
|
||||||
@ -285,6 +289,20 @@ static PyTypeObject typeobj_graph = {
|
|||||||
.tp_methods = methods_graph,
|
.tp_methods = methods_graph,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static PyObject *graph_merge(PyObject *self, PyObject *args)
|
||||||
|
{
|
||||||
|
PyObject *py_other;
|
||||||
|
struct wrap_graph *gwrap = (struct wrap_graph *)self;
|
||||||
|
struct wrap_graph *gother;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTuple(args, "O!", &typeobj_graph, &py_other))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
gother = (struct wrap_graph *)py_other;
|
||||||
|
cmd_graph_merge(gwrap->graph, gother->graph, +1);
|
||||||
|
Py_RETURN_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
/* top call / entrypoint for python code */
|
/* top call / entrypoint for python code */
|
||||||
static PyObject *graph_parse(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
static PyObject *graph_parse(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user