X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_fetch.c;h=abfe66c89a8483a1b1fb9d482ed5857f889f7d1e;hp=568e26228aa638ca4d7e88c8af25a158cf042dbe;hb=aff0a2728543eee1ac21f3fa02f171caae8d9362;hpb=a12627275ff8487174cbb907a066f62a00b6ae44 diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c index 568e262..abfe66c 100644 --- a/src/rrd_fetch.c +++ b/src/rrd_fetch.c @@ -235,6 +235,16 @@ int rrd_fetch_fn( *start, *end, *step); #endif +#ifdef HAVE_LIBDBI + /* handle libdbi datasources */ + if (strncmp("sql",filename,3)==0) { + if (filename[3]==filename[4]) { + return rrd_fetch_fn_libdbi(filename,cf_idx,start,end,step,ds_cnt,ds_namv,data); + } + } +#endif + + rrd_init(&rrd); rrd_file = rrd_open(filename, &rrd, RRD_READONLY); if (rrd_file == NULL) goto err_free; @@ -248,7 +258,7 @@ int rrd_fetch_fn( } for (i = 0; (unsigned long) i < rrd.stat_head->ds_cnt; i++) { - if ((((*ds_namv)[i]) = malloc(sizeof(char) * DS_NAM_SIZE)) == NULL) { + if ((((*ds_namv)[i]) = (char*)malloc(sizeof(char) * DS_NAM_SIZE)) == NULL) { rrd_set_error("malloc fetch ds_namv entry"); goto err_free_ds_namv; } @@ -348,7 +358,7 @@ int rrd_fetch_fn( ** database is the one with time stamp (t+s) which means t to t+s. */ *ds_cnt = rrd.stat_head->ds_cnt; - if (((*data) = malloc(*ds_cnt * rows * sizeof(rrd_value_t))) == NULL) { + if (((*data) = (rrd_value_t*)malloc(*ds_cnt * rows * sizeof(rrd_value_t))) == NULL) { rrd_set_error("malloc fetch data area"); goto err_free_all_ds_namv; }