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