indent all the rest of the code, and add some typedefs to indent.pro
[rrdtool.git] / bindings / python / rrdtoolmodule.c
index 6f5b36c..74b7fb0 100644 (file)
@@ -48,16 +48,22 @@ extern int optind;
 extern int opterr;
 
 /* forward declaration to keep compiler happy */
 extern int opterr;
 
 /* forward declaration to keep compiler happy */
-void initrrdtool(void);
-
-static int
-create_args(char *command, PyObject *args, int *argc, char ***argv)
+void      initrrdtool(
+    void);
+
+static int create_args(
+    char *command,
+    PyObject * args,
+    int *argc,
+    char ***argv)
 {
 {
-    PyObject        *o;
-    int              size, i;
-    
-    size    = PyTuple_Size(args);
-    *argv   = PyMem_New(char *, size + 1);
+    PyObject *o;
+    int       size, i;
+
+    size = PyTuple_Size(args);
+    *argv = PyMem_New(char *,
+                      size + 1);
+
     if (*argv == NULL)
         return -1;
 
     if (*argv == NULL)
         return -1;
 
@@ -80,25 +86,26 @@ create_args(char *command, PyObject *args, int *argc, char ***argv)
     return 0;
 }
 
     return 0;
 }
 
-static void
-destroy_args(char ***argv)
+static void destroy_args(
+    char ***argv)
 {
     PyMem_Del(*argv);
     *argv = NULL;
 }
 
 static char PyRRD_create__doc__[] =
 {
     PyMem_Del(*argv);
     *argv = NULL;
 }
 
 static char PyRRD_create__doc__[] =
-"create(args..): Set up a new Round Robin Database\n\
+    "create(args..): Set up a new Round Robin Database\n\
     create filename [--start|-b start time] \
 [--step|-s step] [DS:ds-name:DST:heartbeat:min:max] \
 [RRA:CF:xff:steps:rows]";
 
     create filename [--start|-b start time] \
 [--step|-s step] [DS:ds-name:DST:heartbeat:min:max] \
 [RRA:CF:xff:steps:rows]";
 
-static PyObject *
-PyRRD_create(PyObject UNUSED(*self), PyObject *args)
+static PyObject *PyRRD_create(
+    PyObject UNUSED(*self),
+    PyObject * args)
 {
 {
-    PyObject        *r;
-    char           **argv;
-    int              argc;
+    PyObject *r;
+    char    **argv;
+    int       argc;
 
     if (create_args("create", args, &argc, &argv) < 0)
         return NULL;
 
     if (create_args("create", args, &argc, &argv) < 0)
         return NULL;
@@ -117,16 +124,17 @@ PyRRD_create(PyObject UNUSED(*self), PyObject *args)
 }
 
 static char PyRRD_update__doc__[] =
 }
 
 static char PyRRD_update__doc__[] =
-"update(args..): Store a new set of values into the rrd\n"
-"    update filename [--template|-t ds-name[:ds-name]...] "
-"N|timestamp:value[:value...] [timestamp:value[:value...] ...]";
+    "update(args..): Store a new set of values into the rrd\n"
+    "    update filename [--template|-t ds-name[:ds-name]...] "
+    "N|timestamp:value[:value...] [timestamp:value[:value...] ...]";
 
 
-static PyObject *
-PyRRD_update(PyObject UNUSED(*self), PyObject *args)
+static PyObject *PyRRD_update(
+    PyObject UNUSED(*self),
+    PyObject * args)
 {
 {
-    PyObject        *r;
-    char           **argv;
-    int              argc;
+    PyObject *r;
+    char    **argv;
+    int       argc;
 
     if (create_args("update", args, &argc, &argv) < 0)
         return NULL;
 
     if (create_args("update", args, &argc, &argv) < 0)
         return NULL;
@@ -145,19 +153,20 @@ PyRRD_update(PyObject UNUSED(*self), PyObject *args)
 }
 
 static char PyRRD_fetch__doc__[] =
 }
 
 static char PyRRD_fetch__doc__[] =
-"fetch(args..): fetch data from an rrd.\n"
-"    fetch filename CF [--resolution|-r resolution] "
-"[--start|-s start] [--end|-e end]";
+    "fetch(args..): fetch data from an rrd.\n"
+    "    fetch filename CF [--resolution|-r resolution] "
+    "[--start|-s start] [--end|-e end]";
 
 
-static PyObject *
-PyRRD_fetch(PyObject UNUSED(*self), PyObject *args)
+static PyObject *PyRRD_fetch(
+    PyObject UNUSED(*self),
+    PyObject * args)
 {
 {
-    PyObject        *r;
-    rrd_value_t     *data, *datai;
-    unsigned long    step, ds_cnt;
-    time_t           start, end;
-    int              argc;
-    char           **argv, **ds_namv;
+    PyObject *r;
+    rrd_value_t *data, *datai;
+    unsigned long step, ds_cnt;
+    time_t    start, end;
+    int       argc;
+    char    **argv, **ds_namv;
 
     if (create_args("fetch", args, &argc, &argv) < 0)
         return NULL;
 
     if (create_args("fetch", args, &argc, &argv) < 0)
         return NULL;
@@ -169,10 +178,10 @@ PyRRD_fetch(PyObject UNUSED(*self), PyObject *args)
         r = NULL;
     } else {
         /* Return :
         r = NULL;
     } else {
         /* Return :
-          ((start, end, step), (name1, name2, ...), [(data1, data2, ..), ...]) */
-        PyObject    *range_tup, *dsnam_tup, *data_list, *t;
-        unsigned long          i, j, row;
-        rrd_value_t  dv;
+           ((start, end, step), (name1, name2, ...), [(data1, data2, ..), ...]) */
+        PyObject *range_tup, *dsnam_tup, *data_list, *t;
+        unsigned long i, j, row;
+        rrd_value_t dv;
 
         row = ((end - start) / step + 1);
 
 
         row = ((end - start) / step + 1);
 
@@ -186,14 +195,14 @@ PyRRD_fetch(PyObject UNUSED(*self), PyObject *args)
 
         datai = data;
 
 
         datai = data;
 
-        PyTuple_SET_ITEM(range_tup, 0, PyInt_FromLong((long)start));
-        PyTuple_SET_ITEM(range_tup, 1, PyInt_FromLong((long)end));
-        PyTuple_SET_ITEM(range_tup, 2, PyInt_FromLong((long)step));
+        PyTuple_SET_ITEM(range_tup, 0, PyInt_FromLong((long) start));
+        PyTuple_SET_ITEM(range_tup, 1, PyInt_FromLong((long) end));
+        PyTuple_SET_ITEM(range_tup, 2, PyInt_FromLong((long) step));
 
         for (i = 0; i < ds_cnt; i++)
             PyTuple_SET_ITEM(dsnam_tup, i, PyString_FromString(ds_namv[i]));
 
 
         for (i = 0; i < ds_cnt; i++)
             PyTuple_SET_ITEM(dsnam_tup, i, PyString_FromString(ds_namv[i]));
 
-        for (i = 0; i < row; i ++) {
+        for (i = 0; i < row; i++) {
             t = PyTuple_New(ds_cnt);
             PyList_SET_ITEM(data_list, i, t);
 
             t = PyTuple_New(ds_cnt);
             PyList_SET_ITEM(data_list, i, t);
 
@@ -203,14 +212,14 @@ PyRRD_fetch(PyObject UNUSED(*self), PyObject *args)
                     PyTuple_SET_ITEM(t, j, Py_None);
                     Py_INCREF(Py_None);
                 } else {
                     PyTuple_SET_ITEM(t, j, Py_None);
                     Py_INCREF(Py_None);
                 } else {
-                    PyTuple_SET_ITEM(t, j, PyFloat_FromDouble((double)dv));
+                    PyTuple_SET_ITEM(t, j, PyFloat_FromDouble((double) dv));
                 }
             }
         }
 
         for (i = 0; i < ds_cnt; i++)
             free(ds_namv[i]);
                 }
             }
         }
 
         for (i = 0; i < ds_cnt; i++)
             free(ds_namv[i]);
-        free(ds_namv); /* rrdtool don't use PyMem_Malloc :) */
+        free(ds_namv);  /* rrdtool don't use PyMem_Malloc :) */
         free(data);
     }
 
         free(data);
     }
 
@@ -219,54 +228,56 @@ PyRRD_fetch(PyObject UNUSED(*self), PyObject *args)
 }
 
 static char PyRRD_graph__doc__[] =
 }
 
 static char PyRRD_graph__doc__[] =
-"graph(args..): Create a graph based on data from one or several RRD\n"
-"    graph filename [-s|--start seconds] "
-"[-e|--end seconds] [-x|--x-grid x-axis grid and label] "
-"[-y|--y-grid y-axis grid and label] [--alt-y-grid] [--alt-y-mrtg] "
-"[--alt-autoscale] [--alt-autoscale-max] [--units-exponent] value "
-"[-v|--vertical-label text] [-w|--width pixels] [-h|--height pixels] "
-"[-i|--interlaced] "
-"[-f|--imginfo formatstring] [-a|--imgformat GIF|PNG|GD] "
-"[-B|--background value] [-O|--overlay value] "
-"[-U|--unit value] [-z|--lazy] [-o|--logarithmic] "
-"[-u|--upper-limit value] [-l|--lower-limit value] "
-"[-g|--no-legend] [-r|--rigid] [--step value] "
-"[-b|--base value] [-c|--color COLORTAG#rrggbb] "
-"[-t|--title title] [DEF:vname=rrd:ds-name:CF] "
-"[CDEF:vname=rpn-expression] [PRINT:vname:CF:format] "
-"[GPRINT:vname:CF:format] [COMMENT:text] "
-"[HRULE:value#rrggbb[:legend]] [VRULE:time#rrggbb[:legend]] "
-"[LINE{1|2|3}:vname[#rrggbb[:legend]]] "
-"[AREA:vname[#rrggbb[:legend]]] "
-"[STACK:vname[#rrggbb[:legend]]]";
-
-static PyObject *
-PyRRD_graph(PyObject UNUSED(*self), PyObject *args)
+    "graph(args..): Create a graph based on data from one or several RRD\n"
+    "    graph filename [-s|--start seconds] "
+    "[-e|--end seconds] [-x|--x-grid x-axis grid and label] "
+    "[-y|--y-grid y-axis grid and label] [--alt-y-grid] [--alt-y-mrtg] "
+    "[--alt-autoscale] [--alt-autoscale-max] [--units-exponent] value "
+    "[-v|--vertical-label text] [-w|--width pixels] [-h|--height pixels] "
+    "[-i|--interlaced] "
+    "[-f|--imginfo formatstring] [-a|--imgformat GIF|PNG|GD] "
+    "[-B|--background value] [-O|--overlay value] "
+    "[-U|--unit value] [-z|--lazy] [-o|--logarithmic] "
+    "[-u|--upper-limit value] [-l|--lower-limit value] "
+    "[-g|--no-legend] [-r|--rigid] [--step value] "
+    "[-b|--base value] [-c|--color COLORTAG#rrggbb] "
+    "[-t|--title title] [DEF:vname=rrd:ds-name:CF] "
+    "[CDEF:vname=rpn-expression] [PRINT:vname:CF:format] "
+    "[GPRINT:vname:CF:format] [COMMENT:text] "
+    "[HRULE:value#rrggbb[:legend]] [VRULE:time#rrggbb[:legend]] "
+    "[LINE{1|2|3}:vname[#rrggbb[:legend]]] "
+    "[AREA:vname[#rrggbb[:legend]]] " "[STACK:vname[#rrggbb[:legend]]]";
+
+static PyObject *PyRRD_graph(
+    PyObject UNUSED(*self),
+    PyObject * args)
 {
 {
-    PyObject        *r;
-    char           **argv, **calcpr;
-    int              argc, xsize, ysize, i;
-    double          ymin, ymax;
+    PyObject *r;
+    char    **argv, **calcpr;
+    int       argc, xsize, ysize, i;
+    double    ymin, ymax;
+
     if (create_args("graph", args, &argc, &argv) < 0)
         return NULL;
 
     if (create_args("graph", args, &argc, &argv) < 0)
         return NULL;
 
-    if (rrd_graph(argc, argv, &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) == -1) {
+    if (rrd_graph(argc, argv, &calcpr, &xsize, &ysize, NULL, &ymin, &ymax) ==
+        -1) {
         PyErr_SetString(ErrorObject, rrd_get_error());
         rrd_clear_error();
         r = NULL;
     } else {
         r = PyTuple_New(3);
 
         PyErr_SetString(ErrorObject, rrd_get_error());
         rrd_clear_error();
         r = NULL;
     } else {
         r = PyTuple_New(3);
 
-        PyTuple_SET_ITEM(r, 0, PyInt_FromLong((long)xsize));
-        PyTuple_SET_ITEM(r, 1, PyInt_FromLong((long)ysize));
+        PyTuple_SET_ITEM(r, 0, PyInt_FromLong((long) xsize));
+        PyTuple_SET_ITEM(r, 1, PyInt_FromLong((long) ysize));
 
         if (calcpr) {
 
         if (calcpr) {
-            PyObject    *e, *t;
-            
+            PyObject *e, *t;
+
             e = PyList_New(0);
             PyTuple_SET_ITEM(r, 2, e);
 
             e = PyList_New(0);
             PyTuple_SET_ITEM(r, 2, e);
 
-            for(i = 0; calcpr[i]; i++) {
+            for (i = 0; calcpr[i]; i++) {
                 t = PyString_FromString(calcpr[i]);
                 PyList_Append(e, t);
                 Py_DECREF(t);
                 t = PyString_FromString(calcpr[i]);
                 PyList_Append(e, t);
                 Py_DECREF(t);
@@ -284,17 +295,18 @@ PyRRD_graph(PyObject UNUSED(*self), PyObject *args)
 }
 
 static char PyRRD_tune__doc__[] =
 }
 
 static char PyRRD_tune__doc__[] =
-"tune(args...): Modify some basic properties of a Round Robin Database\n"
-"    tune filename [--heartbeat|-h ds-name:heartbeat] "
-"[--minimum|-i ds-name:min] [--maximum|-a ds-name:max] "
-"[--data-source-type|-d ds-name:DST] [--data-source-rename|-r old-name:new-name]";
-
-static PyObject *
-PyRRD_tune(PyObject UNUSED(*self), PyObject *args)
+    "tune(args...): Modify some basic properties of a Round Robin Database\n"
+    "    tune filename [--heartbeat|-h ds-name:heartbeat] "
+    "[--minimum|-i ds-name:min] [--maximum|-a ds-name:max] "
+    "[--data-source-type|-d ds-name:DST] [--data-source-rename|-r old-name:new-name]";
+
+static PyObject *PyRRD_tune(
+    PyObject UNUSED(*self),
+    PyObject * args)
 {
 {
-    PyObject        *r;
-    char           **argv;
-    int              argc;
+    PyObject *r;
+    char    **argv;
+    int       argc;
 
     if (create_args("tune", args, &argc, &argv) < 0)
         return NULL;
 
     if (create_args("tune", args, &argc, &argv) < 0)
         return NULL;
@@ -313,14 +325,15 @@ PyRRD_tune(PyObject UNUSED(*self), PyObject *args)
 }
 
 static char PyRRD_first__doc__[] =
 }
 
 static char PyRRD_first__doc__[] =
-"first(filename): Return the timestamp of the first data sample in an RRD";
+    "first(filename): Return the timestamp of the first data sample in an RRD";
 
 
-static PyObject *
-PyRRD_first(PyObject UNUSED(*self), PyObject *args)
+static PyObject *PyRRD_first(
+    PyObject UNUSED(*self),
+    PyObject * args)
 {
 {
-    PyObject        *r;
-    int              argc, ts;
-    char           **argv;
+    PyObject *r;
+    int       argc, ts;
+    char    **argv;
 
     if (create_args("first", args, &argc, &argv) < 0)
         return NULL;
 
     if (create_args("first", args, &argc, &argv) < 0)
         return NULL;
@@ -330,21 +343,22 @@ PyRRD_first(PyObject UNUSED(*self), PyObject *args)
         rrd_clear_error();
         r = NULL;
     } else
         rrd_clear_error();
         r = NULL;
     } else
-        r = PyInt_FromLong((long)ts);
+        r = PyInt_FromLong((long) ts);
 
     destroy_args(&argv);
     return r;
 }
 
 static char PyRRD_last__doc__[] =
 
     destroy_args(&argv);
     return r;
 }
 
 static char PyRRD_last__doc__[] =
-"last(filename): Return the timestamp of the last data sample in an RRD";
+    "last(filename): Return the timestamp of the last data sample in an RRD";
 
 
-static PyObject *
-PyRRD_last(PyObject UNUSED(*self), PyObject *args)
+static PyObject *PyRRD_last(
+    PyObject UNUSED(*self),
+    PyObject * args)
 {
 {
-    PyObject        *r;
-    int              argc, ts;
-    char           **argv;
+    PyObject *r;
+    int       argc, ts;
+    char    **argv;
 
     if (create_args("last", args, &argc, &argv) < 0)
         return NULL;
 
     if (create_args("last", args, &argc, &argv) < 0)
         return NULL;
@@ -354,22 +368,23 @@ PyRRD_last(PyObject UNUSED(*self), PyObject *args)
         rrd_clear_error();
         r = NULL;
     } else
         rrd_clear_error();
         r = NULL;
     } else
-        r = PyInt_FromLong((long)ts);
+        r = PyInt_FromLong((long) ts);
 
     destroy_args(&argv);
     return r;
 }
 
 static char PyRRD_resize__doc__[] =
 
     destroy_args(&argv);
     return r;
 }
 
 static char PyRRD_resize__doc__[] =
-"resize(args...): alters the size of an RRA.\n"
-"    resize filename rra-num GROW|SHRINK rows";
+    "resize(args...): alters the size of an RRA.\n"
+    "    resize filename rra-num GROW|SHRINK rows";
 
 
-static PyObject *
-PyRRD_resize(PyObject UNUSED(*self), PyObject *args)
+static PyObject *PyRRD_resize(
+    PyObject UNUSED(*self),
+    PyObject * args)
 {
 {
-    PyObject        *r;
-    char           **argv;
-    int              argc, ts;
+    PyObject *r;
+    char    **argv;
+    int       argc, ts;
 
     if (create_args("resize", args, &argc, &argv) < 0)
         return NULL;
 
     if (create_args("resize", args, &argc, &argv) < 0)
         return NULL;
@@ -388,18 +403,19 @@ PyRRD_resize(PyObject UNUSED(*self), PyObject *args)
 }
 
 static char PyRRD_info__doc__[] =
 }
 
 static char PyRRD_info__doc__[] =
-"info(filename): extract header information from an rrd";
+    "info(filename): extract header information from an rrd";
 
 
-static PyObject *
-PyRRD_info(PyObject UNUSED(*self), PyObject *args)
+static PyObject *PyRRD_info(
+    PyObject UNUSED(*self),
+    PyObject * args)
 {
 {
-    PyObject        *r, *t, *ds;
-    rrd_t            rrd;
-    FILE            *in_file;
-    char            *filename;
-    unsigned long   i, j;
+    PyObject *r, *t, *ds;
+    rrd_t     rrd;
+    FILE     *in_file;
+    char     *filename;
+    unsigned long i, j;
 
 
-    if (! PyArg_ParseTuple(args, "s:info", &filename))
+    if (!PyArg_ParseTuple(args, "s:info", &filename))
         return NULL;
 
     if (rrd_open(filename, &in_file, &rrd, RRD_READONLY) == -1) {
         return NULL;
 
     if (rrd_open(filename, &in_file, &rrd, RRD_READONLY) == -1) {
@@ -437,7 +453,7 @@ PyRRD_info(PyObject UNUSED(*self), PyObject *args)
     Py_DECREF(ds);
 
     for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
     Py_DECREF(ds);
 
     for (i = 0; i < rrd.stat_head->ds_cnt; i++) {
-        PyObject    *d;
+        PyObject *d;
 
         d = PyDict_New();
         PyDict_SetItemString(ds, rrd.ds_def[i].ds_nam, d);
 
         d = PyDict_New();
         PyDict_SetItemString(ds, rrd.ds_def[i].ds_nam, d);
@@ -445,12 +461,14 @@ PyRRD_info(PyObject UNUSED(*self), PyObject *args)
 
         DICTSET_STR(d, "ds_name", rrd.ds_def[i].ds_nam);
         DICTSET_STR(d, "type", rrd.ds_def[i].dst);
 
         DICTSET_STR(d, "ds_name", rrd.ds_def[i].ds_nam);
         DICTSET_STR(d, "type", rrd.ds_def[i].dst);
-        DICTSET_CNT(d, "minimal_heartbeat", rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
+        DICTSET_CNT(d, "minimal_heartbeat",
+                    rrd.ds_def[i].par[DS_mrhb_cnt].u_cnt);
         DICTSET_VAL(d, "min", rrd.ds_def[i].par[DS_min_val].u_val);
         DICTSET_VAL(d, "max", rrd.ds_def[i].par[DS_max_val].u_val);
         DICTSET_STR(d, "last_ds", rrd.pdp_prep[i].last_ds);
         DICTSET_VAL(d, "value", rrd.pdp_prep[i].scratch[PDP_val].u_val);
         DICTSET_VAL(d, "min", rrd.ds_def[i].par[DS_min_val].u_val);
         DICTSET_VAL(d, "max", rrd.ds_def[i].par[DS_max_val].u_val);
         DICTSET_STR(d, "last_ds", rrd.pdp_prep[i].last_ds);
         DICTSET_VAL(d, "value", rrd.pdp_prep[i].scratch[PDP_val].u_val);
-        DICTSET_CNT(d, "unknown_sec", rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
+        DICTSET_CNT(d, "unknown_sec",
+                    rrd.pdp_prep[i].scratch[PDP_unkn_sec_cnt].u_cnt);
     }
 
     ds = PyList_New(rrd.stat_head->rra_cnt);
     }
 
     ds = PyList_New(rrd.stat_head->rra_cnt);
@@ -458,7 +476,7 @@ PyRRD_info(PyObject UNUSED(*self), PyObject *args)
     Py_DECREF(ds);
 
     for (i = 0; i < rrd.stat_head->rra_cnt; i++) {
     Py_DECREF(ds);
 
     for (i = 0; i < rrd.stat_head->rra_cnt; i++) {
-        PyObject    *d, *cdp;
+        PyObject *d, *cdp;
 
         d = PyDict_New();
         PyList_SET_ITEM(ds, i, d);
 
         d = PyDict_New();
         PyList_SET_ITEM(ds, i, d);
@@ -473,15 +491,17 @@ PyRRD_info(PyObject UNUSED(*self), PyObject *args)
         Py_DECREF(cdp);
 
         for (j = 0; j < rrd.stat_head->ds_cnt; j++) {
         Py_DECREF(cdp);
 
         for (j = 0; j < rrd.stat_head->ds_cnt; j++) {
-            PyObject    *cdd;
+            PyObject *cdd;
 
             cdd = PyDict_New();
             PyList_SET_ITEM(cdp, j, cdd);
 
             DICTSET_VAL(cdd, "value",
 
             cdd = PyDict_New();
             PyList_SET_ITEM(cdp, j, cdd);
 
             DICTSET_VAL(cdd, "value",
-                    rrd.cdp_prep[i*rrd.stat_head->ds_cnt+j].scratch[CDP_val].u_val);
+                        rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                     j].scratch[CDP_val].u_val);
             DICTSET_CNT(cdd, "unknown_datapoints",
             DICTSET_CNT(cdd, "unknown_datapoints",
-                    rrd.cdp_prep[i*rrd.stat_head->ds_cnt+j].scratch[CDP_unkn_pdp_cnt].u_cnt);
+                        rrd.cdp_prep[i * rrd.stat_head->ds_cnt +
+                                     j].scratch[CDP_unkn_pdp_cnt].u_cnt);
         }
     }
 
         }
     }
 
@@ -494,16 +514,16 @@ PyRRD_info(PyObject UNUSED(*self), PyObject *args)
 #define meth(name, func, doc) {name, (PyCFunction)func, METH_VARARGS, doc}
 
 static PyMethodDef _rrdtool_methods[] = {
 #define meth(name, func, doc) {name, (PyCFunction)func, METH_VARARGS, doc}
 
 static PyMethodDef _rrdtool_methods[] = {
-    meth("create",  PyRRD_create,   PyRRD_create__doc__),
-    meth("update",  PyRRD_update,   PyRRD_update__doc__),
-    meth("fetch",   PyRRD_fetch,    PyRRD_fetch__doc__),
-    meth("graph",   PyRRD_graph,    PyRRD_graph__doc__),
-    meth("tune",    PyRRD_tune,     PyRRD_tune__doc__),
-    meth("first",   PyRRD_first,    PyRRD_first__doc__),
-    meth("last",    PyRRD_last,     PyRRD_last__doc__),
-    meth("resize",  PyRRD_resize,   PyRRD_resize__doc__),
-    meth("info",    PyRRD_info,     PyRRD_info__doc__),
-    {NULL, NULL,0,NULL}
+    meth("create", PyRRD_create, PyRRD_create__doc__),
+    meth("update", PyRRD_update, PyRRD_update__doc__),
+    meth("fetch", PyRRD_fetch, PyRRD_fetch__doc__),
+    meth("graph", PyRRD_graph, PyRRD_graph__doc__),
+    meth("tune", PyRRD_tune, PyRRD_tune__doc__),
+    meth("first", PyRRD_first, PyRRD_first__doc__),
+    meth("last", PyRRD_last, PyRRD_last__doc__),
+    meth("resize", PyRRD_resize, PyRRD_resize__doc__),
+    meth("info", PyRRD_info, PyRRD_info__doc__),
+    {NULL, NULL, 0, NULL}
 };
 
 #define SET_INTCONSTANT(dict, value) \
 };
 
 #define SET_INTCONSTANT(dict, value) \
@@ -516,10 +536,10 @@ static PyMethodDef _rrdtool_methods[] = {
             Py_DECREF(t);
 
 /* Initialization function for the module */
             Py_DECREF(t);
 
 /* Initialization function for the module */
-void
-initrrdtool(void)
+void initrrdtool(
+    void)
 {
 {
-    PyObject    *m, *d, *t;
+    PyObject *m, *d, *t;
 
     /* Create the module and add the functions */
     m = Py_InitModule("rrdtool", _rrdtool_methods);
 
     /* Create the module and add the functions */
     m = Py_InitModule("rrdtool", _rrdtool_methods);