projects
/
rrdtool.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
even with libdbi enabled, do not mistake "sqlxxabc.rrd" for an sql url -- Peter Stamfest
[rrdtool.git]
/
src
/
rrd_xport.c
diff --git
a/src/rrd_xport.c
b/src/rrd_xport.c
index
225fba5
..
aecd7f3
100644
(file)
--- a/
src/rrd_xport.c
+++ b/
src/rrd_xport.c
@@
-1,5
+1,5
@@
/****************************************************************************
/****************************************************************************
- * RRDtool 1.
3.2 Copyright by Tobi Oetiker, 1997-2008
+ * RRDtool 1.
4.3 Copyright by Tobi Oetiker, 1997-2010
****************************************************************************
* rrd_xport.c export RRD data
****************************************************************************/
****************************************************************************
* rrd_xport.c export RRD data
****************************************************************************/
@@
-58,7
+58,6
@@
int rrd_xport(
time_t start_tmp = 0, end_tmp = 0;
rrd_time_value_t start_tv, end_tv;
char *parsetime_error = NULL;
time_t start_tmp = 0, end_tmp = 0;
rrd_time_value_t start_tv, end_tv;
char *parsetime_error = NULL;
- char *opt_daemon = NULL;
struct option long_options[] = {
{"start", required_argument, 0, 's'},
struct option long_options[] = {
{"start", required_argument, 0, 's'},
@@
-114,15
+113,15
@@
int rrd_xport(
break;
case 'd':
{
break;
case 'd':
{
- if (
opt_daemon
!= NULL)
+ if (
im.daemon_addr
!= NULL)
{
rrd_set_error ("You cannot specify --daemon "
"more than once.");
return (-1);
}
{
rrd_set_error ("You cannot specify --daemon "
"more than once.");
return (-1);
}
-
opt_daemon
= strdup(optarg);
- if (
opt_daemon
== NULL)
+
im.daemon_addr
= strdup(optarg);
+ if (
im.daemon_addr
== NULL)
{
rrd_set_error("strdup error");
return -1;
{
rrd_set_error("strdup error");
return -1;
@@
-169,8
+168,7
@@
int rrd_xport(
}
{ /* try to connect to rrdcached */
}
{ /* try to connect to rrdcached */
- int status = rrdc_connect(opt_daemon);
- if (opt_daemon) free(opt_daemon);
+ int status = rrdc_connect(im.daemon_addr);
if (status != 0) return status;
}
if (status != 0) return status;
}
@@
-233,20
+231,20
@@
int rrd_xport_fn(
}
/* a list of referenced gdes */
}
/* a list of referenced gdes */
- ref_list = malloc(sizeof(int) * (*col_cnt));
+ ref_list =
(int*)
malloc(sizeof(int) * (*col_cnt));
if (ref_list == NULL)
return -1;
/* a list to save pointers to the column's legend entry */
/* this is a return value! */
if (ref_list == NULL)
return -1;
/* a list to save pointers to the column's legend entry */
/* this is a return value! */
- legend_list = malloc(sizeof(char *) * (*col_cnt));
+ legend_list =
(char**)
malloc(sizeof(char *) * (*col_cnt));
if (legend_list == NULL) {
free(ref_list);
return -1;
}
/* lets find the step size we have to use for xport */
if (legend_list == NULL) {
free(ref_list);
return -1;
}
/* lets find the step size we have to use for xport */
- step_list = malloc(sizeof(long)*((*col_cnt)+1));
+ step_list =
(long*)
malloc(sizeof(long)*((*col_cnt)+1));
step_list_ptr = step_list;
j = 0;
for (i = 0; i < im->gdes_c; i++) {
step_list_ptr = step_list;
j = 0;
for (i = 0; i < im->gdes_c; i++) {
@@
-254,12
+252,12
@@
int rrd_xport_fn(
case GF_XPORT:
ref_list[xport_counter++] = i;
*step_list_ptr = im->gdes[im->gdes[i].vidx].step;
case GF_XPORT:
ref_list[xport_counter++] = i;
*step_list_ptr = im->gdes[im->gdes[i].vidx].step;
- printf("%s:%lu\n",im->gdes[i].legend,*step_list_ptr);
+ /* printf("%s:%lu\n",im->gdes[i].legend,*step_list_ptr); */
step_list_ptr++;
/* reserve room for one legend entry */
/* is FMT_LEG_LEN + 5 the correct size? */
if ((legend_list[j] =
step_list_ptr++;
/* reserve room for one legend entry */
/* is FMT_LEG_LEN + 5 the correct size? */
if ((legend_list[j] =
- malloc(sizeof(char) * (FMT_LEG_LEN + 5))) == NULL) {
+
(char*)
malloc(sizeof(char) * (FMT_LEG_LEN + 5))) == NULL) {
free(ref_list);
*data = NULL;
while (--j > -1)
free(ref_list);
*data = NULL;
while (--j > -1)
@@
-282,18
+280,18
@@
int rrd_xport_fn(
*step_list_ptr=0;
/* find a common step */
*step = lcd(step_list);
*step_list_ptr=0;
/* find a common step */
*step = lcd(step_list);
- printf("step: %lu\n",*step);
+ /* printf("step: %lu\n",*step); */
free(step_list);
*start = im->start - im->start % (*step);
free(step_list);
*start = im->start - im->start % (*step);
- *end = im->end - im->end % (*step);
+ *end = im->end - im->end % (*step)
+ (*step)
;
/* room for rearranged data */
/* this is a return value! */
row_cnt = ((*end) - (*start)) / (*step);
if (((*data) =
/* room for rearranged data */
/* this is a return value! */
row_cnt = ((*end) - (*start)) / (*step);
if (((*data) =
-
malloc((*col_cnt) * row_cnt * sizeof(rrd_value_t))) == NULL) {
+
(rrd_value_t*)
malloc((*col_cnt) * row_cnt * sizeof(rrd_value_t))) == NULL) {
free(ref_list);
free(legend_list);
rrd_set_error("malloc xport data area");
free(ref_list);
free(legend_list);
rrd_set_error("malloc xport data area");