output/csv: reduce indentation in process_analog()

Instead of nesting indentation levels upon equality of a value, skip
iterations upon inequality. This reduces indentation, and might improve
readability.

[ Indentation changes, see 'diff -w -b' for the essence. ]
This commit is contained in:
Gerhard Sittig 2018-03-04 17:51:29 +01:00 committed by Uwe Hermann
parent 94cf02d0c2
commit b078dddb84
1 changed files with 16 additions and 15 deletions

View File

@ -314,6 +314,7 @@ static void process_analog(struct context *ctx,
struct sr_analog_meaning *meaning;
GSList *l;
float *fdata = NULL;
struct sr_channel *ch;
if (!ctx->analog_samples) {
ctx->analog_samples = g_malloc(analog->num_samples
@ -334,13 +335,15 @@ static void process_analog(struct context *ctx,
sr_warn("Problems converting data to floating point values.");
for (i = 0; i < ctx->num_analog_channels + ctx->num_logic_channels; i++) {
if (ctx->channels[i].ch->type == SR_CHANNEL_ANALOG) {
if (ctx->channels[i].ch->type != SR_CHANNEL_ANALOG)
continue;
sr_dbg("Looking for channel %s",
ctx->channels[i].ch->name);
for (l = meaning->channels, c = 0; l; l = l->next, c++) {
struct sr_channel *ch = l->data;
ch = l->data;
sr_dbg("Checking %s", ch->name);
if (ctx->channels[i].ch == l->data) {
if (ctx->channels[i].ch != l->data)
continue;
if (ctx->label_do && !ctx->label_names) {
sr_analog_unit_to_string(analog,
&ctx->channels[i].label);
@ -350,8 +353,6 @@ static void process_analog(struct context *ctx,
break;
}
}
}
}
g_free(fdata);
}