csv: Remove unnecessary array of probe names.

This commit is contained in:
Martin Ling 2013-04-26 22:26:14 +01:00 committed by Bert Vermeulen
parent 91a44f50f0
commit 1c5b099a13
1 changed files with 9 additions and 9 deletions

View File

@ -37,7 +37,6 @@
struct context { struct context {
unsigned int num_enabled_probes; unsigned int num_enabled_probes;
unsigned int unitsize; unsigned int unitsize;
char *probelist[SR_MAX_NUM_PROBES + 1];
uint64_t samplerate; uint64_t samplerate;
GString *header; GString *header;
char separator; char separator;
@ -63,7 +62,6 @@ static int init(struct sr_output *o)
GVariant *gvar; GVariant *gvar;
int num_probes; int num_probes;
time_t t; time_t t;
unsigned int i;
if (!o) { if (!o) {
sr_err("%s: o was NULL", __func__); sr_err("%s: o was NULL", __func__);
@ -87,14 +85,13 @@ static int init(struct sr_output *o)
o->internal = ctx; o->internal = ctx;
/* Get the number of probes, their names, and the unitsize. */ /* Get the number of probes, and the unitsize. */
for (l = o->sdi->probes; l; l = l->next) { for (l = o->sdi->probes; l; l = l->next) {
probe = l->data; probe = l->data;
if (!probe->enabled) if (probe->enabled)
continue; ctx->num_enabled_probes++;
ctx->probelist[ctx->num_enabled_probes++] = probe->name;
} }
ctx->probelist[ctx->num_enabled_probes] = 0;
ctx->unitsize = (ctx->num_enabled_probes + 7) / 8; ctx->unitsize = (ctx->num_enabled_probes + 7) / 8;
num_probes = g_slist_length(o->sdi->probes); num_probes = g_slist_length(o->sdi->probes);
@ -120,8 +117,11 @@ static int init(struct sr_output *o)
/* Columns / channels */ /* Columns / channels */
g_string_append_printf(ctx->header, "; Channels (%d/%d): ", g_string_append_printf(ctx->header, "; Channels (%d/%d): ",
ctx->num_enabled_probes, num_probes); ctx->num_enabled_probes, num_probes);
for (i = 0; i < ctx->num_enabled_probes; i++) for (l = o->sdi->probes; l; l = l->next) {
g_string_append_printf(ctx->header, "%s, ", ctx->probelist[i]); probe = l->data;
if (probe->enabled)
g_string_append_printf(ctx->header, "%s, ", probe->name);
}
g_string_append_printf(ctx->header, "\n"); g_string_append_printf(ctx->header, "\n");
return SR_OK; return SR_OK;