From 0a3b51a228c6b6a15df9fd0bcc35fdb1af61d3df Mon Sep 17 00:00:00 2001 From: Magnus Jacobsson Date: Fri, 28 Aug 2020 09:25:39 +0200 Subject: [PATCH] Remove 1 -Wbad-function-cast warning in agdelsubg Restores the public API to what's documented in cgraph.3 by instead of casting the void pointer that dtdelete returns to long, returns an int which is 0 if the pointer is NULL and 1 otherwise. Internally the return value is however not used today. --- lib/cgraph/cgraph.h | 2 +- lib/cgraph/subg.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/cgraph/cgraph.h b/lib/cgraph/cgraph.h index c6a3f86e2..8ee2fc449 100644 --- a/lib/cgraph/cgraph.h +++ b/lib/cgraph/cgraph.h @@ -300,7 +300,7 @@ CGRAPH_API char *agnameof(void *); CGRAPH_API int agrelabel(void *obj, char *name); /* scary */ CGRAPH_API int agrelabel_node(Agnode_t * n, char *newname); CGRAPH_API int agdelete(Agraph_t * g, void *obj); -CGRAPH_API long agdelsubg(Agraph_t * g, Agraph_t * sub); /* could be agclose */ +CGRAPH_API int agdelsubg(Agraph_t * g, Agraph_t * sub); /* could be agclose */ CGRAPH_API int agdelnode(Agraph_t * g, Agnode_t * arg_n); CGRAPH_API int agdeledge(Agraph_t * g, Agedge_t * arg_e); CGRAPH_API int agobjkind(void *); diff --git a/lib/cgraph/subg.c b/lib/cgraph/subg.c index 4d0d3da05..0e9acb18c 100644 --- a/lib/cgraph/subg.c +++ b/lib/cgraph/subg.c @@ -90,7 +90,7 @@ Agraph_t *agparent(Agraph_t * g) /* this function is only responsible for deleting the entry * in the parent's subg dict. the rest is done in agclose(). */ -long agdelsubg(Agraph_t * g, Agraph_t * subg) +int agdelsubg(Agraph_t * g, Agraph_t * subg) { - return (long) dtdelete(g->g_dict, subg); + return dtdelete(g->g_dict, subg) != NULL; } -- 2.50.0