python uses the name of the module for loding, so this should better match up --...
[rrdtool.git] / bindings / python / rrdtoolmodule.c
index c1ff42f..f5a96d9 100644 (file)
  *
  */
 
+#ifdef UNUSED
+#elif defined(__GNUC__)
+# define UNUSED(x) x __attribute__((unused))
+#elif defined(__LCLINT__)
+# define UNUSED(x) /*@unused@*/ x
+#else
+# define UNUSED(x) x
+#endif
+
 static const char *__version__ = "$Revision: 1.14 $";
 
 #include "Python.h"
@@ -39,7 +48,8 @@ extern int optind;
 extern int opterr;
 
 /* forward declaration to keep compiler happy */
-void initrrdtool(void);
+/*void initrrdtool(void);*/
+void initrrdtoolmodule(void);
 
 static int
 create_args(char *command, PyObject *args, int *argc, char ***argv)
@@ -85,7 +95,7 @@ static char PyRRD_create__doc__[] =
 [RRA:CF:xff:steps:rows]";
 
 static PyObject *
-PyRRD_create(PyObject *self, PyObject *args)
+PyRRD_create(PyObject UNUSED(*self), PyObject *args)
 {
     PyObject        *r;
     char           **argv;
@@ -113,7 +123,7 @@ static char PyRRD_update__doc__[] =
 "N|timestamp:value[:value...] [timestamp:value[:value...] ...]";
 
 static PyObject *
-PyRRD_update(PyObject *self, PyObject *args)
+PyRRD_update(PyObject UNUSED(*self), PyObject *args)
 {
     PyObject        *r;
     char           **argv;
@@ -141,7 +151,7 @@ static char PyRRD_fetch__doc__[] =
 "[--start|-s start] [--end|-e end]";
 
 static PyObject *
-PyRRD_fetch(PyObject *self, PyObject *args)
+PyRRD_fetch(PyObject UNUSED(*self), PyObject *args)
 {
     PyObject        *r;
     rrd_value_t     *data, *datai;
@@ -232,7 +242,7 @@ static char PyRRD_graph__doc__[] =
 "[STACK:vname[#rrggbb[:legend]]]";
 
 static PyObject *
-PyRRD_graph(PyObject *self, PyObject *args)
+PyRRD_graph(PyObject UNUSED(*self), PyObject *args)
 {
     PyObject        *r;
     char           **argv, **calcpr;
@@ -281,7 +291,7 @@ static char PyRRD_tune__doc__[] =
 "[--data-source-type|-d ds-name:DST] [--data-source-rename|-r old-name:new-name]";
 
 static PyObject *
-PyRRD_tune(PyObject *self, PyObject *args)
+PyRRD_tune(PyObject UNUSED(*self), PyObject *args)
 {
     PyObject        *r;
     char           **argv;
@@ -307,7 +317,7 @@ static char PyRRD_last__doc__[] =
 "last(filename): Return the timestamp of the last data sample in an RRD";
 
 static PyObject *
-PyRRD_last(PyObject *self, PyObject *args)
+PyRRD_last(PyObject UNUSED(*self), PyObject *args)
 {
     PyObject        *r;
     int              argc, ts;
@@ -332,7 +342,7 @@ static char PyRRD_resize__doc__[] =
 "    resize filename rra-num GROW|SHRINK rows";
 
 static PyObject *
-PyRRD_resize(PyObject *self, PyObject *args)
+PyRRD_resize(PyObject UNUSED(*self), PyObject *args)
 {
     PyObject        *r;
     char           **argv;
@@ -358,7 +368,7 @@ static char PyRRD_info__doc__[] =
 "info(filename): extract header information from an rrd";
 
 static PyObject *
-PyRRD_info(PyObject *self, PyObject *args)
+PyRRD_info(PyObject UNUSED(*self), PyObject *args)
 {
     PyObject        *r, *t, *ds;
     rrd_t            rrd;
@@ -469,7 +479,7 @@ static PyMethodDef _rrdtool_methods[] = {
     meth("last",    PyRRD_last,     PyRRD_last__doc__),
     meth("resize",  PyRRD_resize,   PyRRD_resize__doc__),
     meth("info",    PyRRD_info,     PyRRD_info__doc__),
-    {NULL, NULL}
+    {NULL, NULL,0,NULL}
 };
 
 #define SET_INTCONSTANT(dict, value) \
@@ -483,18 +493,19 @@ static PyMethodDef _rrdtool_methods[] = {
 
 /* Initialization function for the module */
 void
-initrrdtool(void)
+/*initrrdtool(void)*/
+initrrdtoolmodule(void)
 {
     PyObject    *m, *d, *t;
 
     /* Create the module and add the functions */
-    m = Py_InitModule("rrdtool", _rrdtool_methods);
+    m = Py_InitModule("rrdtoolmodule", _rrdtool_methods);
 
     /* Add some symbolic constants to the module */
     d = PyModule_GetDict(m);
 
     SET_STRCONSTANT(d, __version__);
-    ErrorObject = PyErr_NewException("_rrdtool.error", NULL, NULL);
+    ErrorObject = PyErr_NewException("rrdtoolmodule.error", NULL, NULL);
     PyDict_SetItemString(d, "error", ErrorObject);
 
     /* Check for errors */