]> sigrok.org Git - libsigrok.git/commitdiff
code cleanup
authorBert Vermeulen <redacted>
Tue, 11 Jan 2011 22:49:32 +0000 (23:49 +0100)
committerBert Vermeulen <redacted>
Tue, 11 Jan 2011 22:59:33 +0000 (23:59 +0100)
output/output_text.c

index 3c3fbb5046229120607520c19a9d3928c0b49345..42fd1cac45eafe1eb6d1c7ed4ee08e0b3689f51d 100644 (file)
@@ -112,8 +112,8 @@ static int init(struct output *o, int default_spl)
        }
 
        snprintf(ctx->header, 511, "%s\n", PACKAGE_STRING);
+       num_probes = g_slist_length(o->device->probes);
        if (o->device->plugin) {
-               num_probes = g_slist_length(o->device->probes);
                samplerate = *((uint64_t *) o->device->plugin->get_device_info(
                                o->device->plugin_index, DI_CUR_SAMPLERATE));
                if (!(samplerate_s = sigrok_samplerate_string(samplerate))) {
@@ -154,6 +154,8 @@ static int event(struct output *o, int event_type, char **data_out,
        switch (event_type) {
        case DF_TRIGGER:
                ctx->mark_trigger = ctx->spl_cnt;
+               *data_out = NULL;
+               *length_out = 0;
                break;
        case DF_END:
                outsize = ctx->num_enabled_probes
@@ -166,6 +168,10 @@ static int event(struct output *o, int event_type, char **data_out,
                free(o->internal);
                o->internal = NULL;
                break;
+       default:
+               *data_out = NULL;
+               *length_out = 0;
+               break;
        }
 
        return SIGROK_OK;