From: Tobias Oetiker Date: Thu, 26 Jun 2014 13:37:18 +0000 (+0200) Subject: handle missing rrd_graph support X-Git-Tag: v1.5.0-rc1~70^2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d81930599d9f0710568ab3eb121309502e58bc19;p=thirdparty%2Frrdtool-1.x.git handle missing rrd_graph support --- 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