From d81930599d9f0710568ab3eb121309502e58bc19 Mon Sep 17 00:00:00 2001 From: Tobias Oetiker Date: Thu, 26 Jun 2014 15:37:18 +0200 Subject: [PATCH] handle missing rrd_graph support --- bindings/lua/rrdlua.c | 10 ++++++++++ bindings/perl-shared/RRDs.xs | 16 ++++++++++++---- bindings/python/rrdtoolmodule.c | 8 ++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/bindings/lua/rrdlua.c b/bindings/lua/rrdlua.c index 690ba29b..bfbc174b 100644 --- a/bindings/lua/rrdlua.c +++ b/bindings/lua/rrdlua.c @@ -267,6 +267,8 @@ lua_rrd_last (lua_State * L) return 1; } +#ifdef HAVE_RRD_GRAPH + static int lua_rrd_graph (lua_State * L) { @@ -292,6 +294,8 @@ lua_rrd_graph (lua_State * L) return 3; } +#endif + static int lua_rrd_flushcached(lua_State *L) { @@ -305,12 +309,16 @@ lua_rrd_info (lua_State * L) return lua_rrd_infocall(L, "info", rrd_info); } +#ifdef HAVE_RRD_GRAPH + static int lua_rrd_graphv (lua_State * L) { return lua_rrd_infocall(L, "graphv", rrd_graph_v); } +#endif + static int lua_rrd_updatev (lua_State * L) { @@ -347,7 +355,9 @@ static const struct luaL_reg rrd[] = { {"dump", lua_rrd_dump}, {"fetch", lua_rrd_fetch}, {"first", lua_rrd_first}, +#ifdef HAVE_RRD_GRAPH {"graph", lua_rrd_graph}, +#endif {"last", lua_rrd_last}, {"resize", lua_rrd_resize}, {"restore", lua_rrd_restore}, diff --git a/bindings/perl-shared/RRDs.xs b/bindings/perl-shared/RRDs.xs index 9f7c2119..e8c24700 100644 --- a/bindings/perl-shared/RRDs.xs +++ b/bindings/perl-shared/RRDs.xs @@ -181,7 +181,7 @@ static int rrd_fetch_cb_wrapper( rrd_set_error("Expected the perl callback function to return a reference"); goto error_out; } - retHV = SvRV(retSV); + retHV = (HV*)SvRV(retSV); if (SvTYPE(retHV) != SVt_PVHV) { rrd_set_error("Expected the perl callback function to return a hash reference"); goto error_out; @@ -213,7 +213,7 @@ static int rrd_fetch_cb_wrapper( rrd_set_error("Expected the perl callback function to return a valid data element"); goto error_out; } - retHV = SvRV(retSV); + retHV = (HV*)SvRV(retSV); if (SvTYPE(retHV) != SVt_PVHV){ rrd_set_error("Expected the perl callback function to return data element pointing to a hash"); goto error_out; @@ -243,7 +243,7 @@ static int rrd_fetch_cb_wrapper( rrd_set_error("Expected the perl callback function to return an array pointer for {data}->{%s}",(*ds_namv)[i]); goto error_out_free_ds_namv; } - retAV = SvRV(retSV); + retAV = (AV*)SvRV(retSV); if (SvTYPE(retAV) != SVt_PVAV){ rrd_set_error("Expected the perl callback function to return an array pointer for {data}->{%s}",(*ds_namv)[i]); goto error_out_free_ds_namv; @@ -258,7 +258,7 @@ static int rrd_fetch_cb_wrapper( } for (i=0;i<*ds_cnt;i++){ - retAV = SvRV(HeVAL(hv_fetch_ent(retHV,sv_2mortal(newSVpv((*ds_namv)[i],0)),0,0))); + retAV = (AV*)SvRV(HeVAL(hv_fetch_ent(retHV,sv_2mortal(newSVpv((*ds_namv)[i],0)),0,0))); for (ii=0;ii