{
edg_wll_Stats *stats = default_stats; /* XXX: hardcoded */
struct edg_wll_stats_group *g;
- int i;
+ int i, shift;
char *sig = NULL;
int err;
/* all groups */
*rates = (float*)malloc(stats->grpno * sizeof((*rates)[0]));
*groups = (char**)malloc((stats->grpno+1) * sizeof((*groups)[0]));
+ shift = 0;
for (i=0, g=stats->map; i<stats->grpno; i++) {
- (*rates)[i] = 0;
- (*groups)[i] = NULL;
- if ((err = stateRateRequest(ctx, stats, g, from, to, &((*rates)[i]), res_from, res_to)))
- continue; //TODO in fact breaks results here
- (*groups)[i] = strdup(g->destination);
+ (*rates)[i-shift] = 0;
+ (*groups)[i-shift] = NULL;
+ if ((err = stateRateRequest(ctx, stats, g, from, to, &((*rates)[i-shift]), res_from, res_to))){
+ shift++;
+ g = (struct edg_wll_stats_group *) (((char *) g) + stats->grpsize);
+ continue;
+ }
+ (*groups)[i-shift] = strdup(g->destination);
g = (struct edg_wll_stats_group *) (((char *) g) + stats->grpsize);
}
- (*groups)[i] = NULL;
+ (*groups)[i-shift] = NULL;
if (i == 0){
edg_wll_SetError(ctx,ENOENT,"no matching group");
free(*rates); *rates = NULL;
struct edg_wll_stats_group *g;
char *sig = NULL;
int err;
- int i;
+ int i, shift;
edg_wll_ResetError(ctx);
*durations = NULL;
*durations = (float*)malloc(stats->grpno * sizeof((*durations)[0]));
*dispersions = (float*)malloc(stats->grpno * sizeof((*dispersions)[0]));
*groups = (char**)malloc((stats->grpno+1) * sizeof((*groups)[0]));
+ shift = 0;
for (i=0, g=stats->map; i<stats->grpno; i++) {
- (*durations)[i] = 0;
- (*dispersions)[i] = 0;
- (*groups)[i] = NULL;
- if ((err = stateDurationFromToRequest(ctx, stats, g, from, to, &((*durations)[i]), &((*dispersions)[i]), res_from, res_to)))
- continue; //TODO in fact breaks results here
- (*groups)[i] = strdup(g->destination);
+ (*durations)[i-shift] = 0;
+ (*dispersions)[i-shift] = 0;
+ (*groups)[i-shift] = NULL;
+ if ((err = stateDurationFromToRequest(ctx, stats, g, from, to, &((*durations)[i-shift]), &((*dispersions)[i-shift]), res_from, res_to))){
+ shift++;
+ g = (struct edg_wll_stats_group *) (((char *) g) + stats->grpsize);
+ continue;
+ }
+ (*groups)[i-shift] = strdup(g->destination);
g = (struct edg_wll_stats_group *) (((char *) g) + stats->grpsize);
}
- (*groups)[i] = NULL;
+ (*groups)[i-shift] = NULL;
if (i == 0){
edg_wll_SetError(ctx,ENOENT,"no matching group");
free(*durations); *durations = NULL;