From eeed837f2317f52b5dd984c71fe2604dbf47ed65 Mon Sep 17 00:00:00 2001 From: Rot127 Date: Sat, 27 Jul 2024 09:52:42 -0500 Subject: [PATCH] Add docs and assert --- librz/core/cgraph.c | 1 + librz/util/graph.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/librz/core/cgraph.c b/librz/core/cgraph.c index 4d8d0f259d4..2f149cc9762 100644 --- a/librz/core/cgraph.c +++ b/librz/core/cgraph.c @@ -867,6 +867,7 @@ static void extend_icfg(const RzAnalysis *analysis, RZ_BORROW RzGraph /*nodes : NULL; } -/* true if there is an edge from the node `from` to the node `to` */ +/** + * \brief Checks if the edge \p from -> \p to exists in the graph. + * For this it checks the neighbors of \p from. + * + * \param g The graph to check. + * \param from The pointer to the source node of the edge. The pointer must be a node in the graph. + * \param to The destination node of the edge. The pointer must be a node in the graph. + * + * NOTE: It only compares the pointer of \p to against the neighbor list of \p from. + * If the pointer doesn't match it returns false. Even if the node content is the same. + * + * \returns true If there is an edge from the node `from` to the node `to` + * \return false Otherwise + */ RZ_API bool rz_graph_adjacent(const RzGraph *g, const RzGraphNode *from, const RzGraphNode *to) { if (!g || !from) { return false;