]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
handle missing rrd_graph support
authorTobias Oetiker <tobi@oetiker.ch>
Thu, 26 Jun 2014 13:37:18 +0000 (15:37 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Thu, 26 Jun 2014 13:37:18 +0000 (15:37 +0200)
bindings/lua/rrdlua.c
bindings/perl-shared/RRDs.xs
bindings/python/rrdtoolmodule.c

index 690ba29b740634f725852ae40ca35c5f7fbed745..bfbc174b89822a1330419e437719e2c80403e687 100644 (file)
@@ -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},
index 9f7c21194a6f7fedd81bc352db81c0c0d7a304d2..e8c24700f96dbdca547dde2eb4cf45591fe50767 100644 (file)
@@ -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<rowCount;ii++){
             SV** valP = av_fetch(retAV,ii,0);
             SV* val = valP ? *valP : &PL_sv_undef;
@@ -366,6 +366,8 @@ rrd_tune(...)
        OUTPUT:
                RETVAL
 
+#ifdef HAVE_RRD_GRAPH
+
 SV *
 rrd_graph(...)
        PROTOTYPE: @    
@@ -412,6 +414,8 @@ rrd_graph(...)
                PUSHs(sv_2mortal(newSViv(xsize)));
                PUSHs(sv_2mortal(newSViv(ysize)));
 
+#endif /* HAVE_RRD_GRAPH */
+
 SV *
 rrd_fetch(...)
        PROTOTYPE: @    
@@ -584,6 +588,8 @@ rrd_updatev(...)
     OUTPUT:
           RETVAL
 
+#ifdef HAVE_RRD_GRAPH
+
 SV*
 rrd_graphv(...)
        PROTOTYPE: @    
@@ -597,6 +603,8 @@ rrd_graphv(...)
     OUTPUT:
           RETVAL
 
+#endif /* HAVE_RRD_GRAPH */
+
 int
 rrd_dump(...)
        PROTOTYPE: @
index 9ac1bf3ba904b0ca46c1862a08ac891ecd5badc8..900384dc19f79d34c8d5b8367f01e271f627cc48 100644 (file)
@@ -261,6 +261,8 @@ static PyObject *PyRRD_fetch(
     return r;
 }
 
+#ifdef HAVE_RRD_GRAPH
+
 static char PyRRD_graph__doc__[] =
     "graph(args..): Create a graph based on data from one or several RRD\n"
     "    graph filename [-s|--start seconds] "
@@ -328,6 +330,8 @@ static PyObject *PyRRD_graph(
     return r;
 }
 
+#endif /* HAVE_RRD_GRAPH */
+
 static char PyRRD_tune__doc__[] =
     "tune(args...): Modify some basic properties of a Round Robin Database\n"
     "    tune filename [--heartbeat|-h ds-name:heartbeat] "
@@ -503,6 +507,8 @@ static PyObject *PyRRD_info(
     return r;
 }
 
+#ifdef HAVE_RRD_GRAPH
+
 static char PyRRD_graphv__doc__[] =
     "graphv is called in the same manner as graph";
 
@@ -531,6 +537,8 @@ static PyObject *PyRRD_graphv(
     return r;
 }
 
+#endif /* HAVE_RRD_GRAPH */
+
 static char PyRRD_updatev__doc__[] =
     "updatev is called in the same manner as update";