From: Bert Vermeulen Date: Mon, 28 Jul 2014 13:56:17 +0000 (+0200) Subject: output: Rename instance private storage pointer to priv. X-Git-Tag: libsigrok-0.4.0~1187 X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=d686c5ec462a4044e049931e57d60e9d08df8cde;hp=dddabe37052d0d8c7fbd2ac3e15861e556c4814f;p=libsigrok.git output: Rename instance private storage pointer to priv. This makes it consistent with other libsigrok fields used for this purpose. --- diff --git a/src/libsigrok-internal.h b/src/libsigrok-internal.h index 2a4384c4..642277eb 100644 --- a/src/libsigrok-internal.h +++ b/src/libsigrok-internal.h @@ -177,7 +177,7 @@ struct sr_output { * For example, the module might store a pointer to a chunk of output * there, and only flush it when it reaches a certain size. */ - void *internal; + void *priv; }; /** Output module driver. */ diff --git a/src/output/analog.c b/src/output/analog.c index f81e683c..b4985a4e 100644 --- a/src/output/analog.c +++ b/src/output/analog.c @@ -46,7 +46,7 @@ static int init(struct sr_output *o, GHashTable *options) sr_err("Output module context malloc failed."); return SR_ERR_MALLOC; } - o->internal = ctx; + o->priv = ctx; /* Get the number of channels and their names. */ ctx->channellist = g_ptr_array_new(); @@ -259,11 +259,11 @@ static int cleanup(struct sr_output *o) if (!o || !o->sdi) return SR_ERR_ARG; - ctx = o->internal; + ctx = o->priv; g_ptr_array_free(ctx->channellist, 1); g_free(ctx); - o->internal = NULL; + o->priv = NULL; return SR_OK; } diff --git a/src/output/ascii.c b/src/output/ascii.c index 72eb6822..4d97479c 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -77,7 +77,7 @@ static int init(struct sr_output *o, GHashTable *options) } ctx = g_malloc0(sizeof(struct context)); - o->internal = ctx; + o->priv = ctx; ctx->trigger = -1; ctx->samples_per_line = spl; @@ -119,7 +119,7 @@ static GString *gen_header(const struct sr_output *o) int num_channels; char *samplerate_s; - ctx = o->internal; + ctx = o->priv; if (ctx->samplerate == 0) { if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE, &gvar) == SR_OK) { @@ -158,7 +158,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p *out = NULL; if (!o || !o->sdi) return SR_ERR_ARG; - if (!(ctx = o->internal)) + if (!(ctx = o->priv)) return SR_ERR_ARG; switch (packet->type) { @@ -240,7 +240,7 @@ static int cleanup(struct sr_output *o) if (!o) return SR_ERR_ARG; - if (!(ctx = o->internal)) + if (!(ctx = o->priv)) return SR_OK; g_free(ctx->channel_index); @@ -250,7 +250,7 @@ static int cleanup(struct sr_output *o) g_string_free(ctx->lines[i], TRUE); g_free(ctx->lines); g_free(ctx); - o->internal = NULL; + o->priv = NULL; return SR_OK; } diff --git a/src/output/bits.c b/src/output/bits.c index 1035d849..e9eace07 100644 --- a/src/output/bits.c +++ b/src/output/bits.c @@ -72,7 +72,7 @@ static int init(struct sr_output *o, GHashTable *options) } ctx = g_malloc0(sizeof(struct context)); - o->internal = ctx; + o->priv = ctx; ctx->trigger = -1; ctx->samples_per_line = spl; @@ -113,7 +113,7 @@ static GString *gen_header(const struct sr_output *o) int num_channels; char *samplerate_s; - ctx = o->internal; + ctx = o->priv; if (ctx->samplerate == 0) { if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE, &gvar) == SR_OK) { @@ -152,7 +152,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p *out = NULL; if (!o || !o->sdi) return SR_ERR_ARG; - if (!(ctx = o->internal)) + if (!(ctx = o->priv)) return SR_ERR_ARG; switch (packet->type) { @@ -227,7 +227,7 @@ static int cleanup(struct sr_output *o) if (!o) return SR_ERR_ARG; - if (!(ctx = o->internal)) + if (!(ctx = o->priv)) return SR_OK; g_free(ctx->channel_index); @@ -236,7 +236,7 @@ static int cleanup(struct sr_output *o) g_string_free(ctx->lines[i], TRUE); g_free(ctx->lines); g_free(ctx); - o->internal = NULL; + o->priv = NULL; return SR_OK; } diff --git a/src/output/chronovu_la8.c b/src/output/chronovu_la8.c index 4263fc36..c5012384 100644 --- a/src/output/chronovu_la8.c +++ b/src/output/chronovu_la8.c @@ -87,7 +87,7 @@ static int init(struct sr_output *o, GHashTable *options) return SR_ERR_ARG; ctx = g_malloc0(sizeof(struct context)); - o->internal = ctx; + o->priv = ctx; for (l = o->sdi->channels; l; l = l->next) { ch = l->data; @@ -115,7 +115,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p *out = NULL; if (!o || !o->sdi) return SR_ERR_ARG; - if (!(ctx = o->internal)) + if (!(ctx = o->priv)) return SR_ERR_ARG; switch (packet->type) { @@ -172,12 +172,12 @@ static int cleanup(struct sr_output *o) if (!o || !o->sdi) return SR_ERR_ARG; - if (o->internal) { - ctx = o->internal; + if (o->priv) { + ctx = o->priv; g_string_free(ctx->pretrig_buf, TRUE); g_free(ctx->channel_index); - g_free(o->internal); - o->internal = NULL; + g_free(o->priv); + o->priv = NULL; } return SR_OK; diff --git a/src/output/csv.c b/src/output/csv.c index 6ac7a77f..86df2613 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -60,7 +60,7 @@ static int init(struct sr_output *o, GHashTable *options) return SR_ERR_ARG; ctx = g_malloc0(sizeof(struct context)); - o->internal = ctx; + o->priv = ctx; ctx->separator = ','; /* Get the number of channels, and the unitsize. */ @@ -98,7 +98,7 @@ static GString *gen_header(const struct sr_output *o) int num_channels, i; char *samplerate_s; - ctx = o->internal; + ctx = o->priv; header = g_string_sized_new(512); /* Some metadata */ @@ -154,7 +154,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p *out = NULL; if (!o || !o->sdi) return SR_ERR_ARG; - if (!(ctx = o->internal)) + if (!(ctx = o->priv)) return SR_ERR_ARG; switch (packet->type) { @@ -203,11 +203,11 @@ static int cleanup(struct sr_output *o) if (!o || !o->sdi) return SR_ERR_ARG; - if (o->internal) { - ctx = o->internal; + if (o->priv) { + ctx = o->priv; g_free(ctx->channel_index); - g_free(o->internal); - o->internal = NULL; + g_free(o->priv); + o->priv = NULL; } return SR_OK; diff --git a/src/output/gnuplot.c b/src/output/gnuplot.c index 7af41740..8cd67b3e 100644 --- a/src/output/gnuplot.c +++ b/src/output/gnuplot.c @@ -57,7 +57,7 @@ static int init(struct sr_output *o, GHashTable *options) return SR_ERR_ARG; ctx = g_malloc0(sizeof(struct context)); - o->internal = ctx; + o->priv = ctx; ctx->num_enabled_channels = 0; for (l = o->sdi->channels; l; l = l->next) { ch = l->data; @@ -96,7 +96,7 @@ static GString *gen_header(const struct sr_output *o) unsigned int num_channels, i; char *samplerate_s; - ctx = o->internal; + ctx = o->priv; if (ctx->samplerate == 0) { if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE, &gvar) == SR_OK) { @@ -144,9 +144,9 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p unsigned int curbit, p, idx, i; *out = NULL; - if (!o || !o->internal) + if (!o || !o->priv) return SR_ERR_BUG; - ctx = o->internal; + ctx = o->priv; if (packet->type == SR_DF_META) { meta = packet->payload; @@ -207,9 +207,9 @@ static int cleanup(struct sr_output *o) { struct context *ctx; - if (!o || !o->internal) + if (!o || !o->priv) return SR_ERR_BUG; - ctx = o->internal; + ctx = o->priv; g_free(ctx->channel_index); g_free(ctx->prevsample); g_free(ctx); diff --git a/src/output/hex.c b/src/output/hex.c index 313dace8..428dd584 100644 --- a/src/output/hex.c +++ b/src/output/hex.c @@ -76,7 +76,7 @@ static int init(struct sr_output *o, GHashTable *options) } ctx = g_malloc0(sizeof(struct context)); - o->internal = ctx; + o->priv = ctx; ctx->trigger = -1; ctx->samples_per_line = spl; @@ -119,7 +119,7 @@ static GString *gen_header(const struct sr_output *o) int num_channels; char *samplerate_s; - ctx = o->internal; + ctx = o->priv; if (ctx->samplerate == 0) { if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE, &gvar) == SR_OK) { @@ -158,7 +158,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p *out = NULL; if (!o || !o->sdi) return SR_ERR_ARG; - if (!(ctx = o->internal)) + if (!(ctx = o->priv)) return SR_ERR_ARG; switch (packet->type) { @@ -241,7 +241,7 @@ static int cleanup(struct sr_output *o) if (!o) return SR_ERR_ARG; - if (!(ctx = o->internal)) + if (!(ctx = o->priv)) return SR_OK; g_free(ctx->channel_index); @@ -251,7 +251,7 @@ static int cleanup(struct sr_output *o) g_string_free(ctx->lines[i], TRUE); g_free(ctx->lines); g_free(ctx); - o->internal = NULL; + o->priv = NULL; return SR_OK; } diff --git a/src/output/ols.c b/src/output/ols.c index 8c9cca8d..8d68bdaf 100644 --- a/src/output/ols.c +++ b/src/output/ols.c @@ -48,7 +48,7 @@ static int init(struct sr_output *o, GHashTable *options) sr_err("%s: ctx malloc failed", __func__); return SR_ERR_MALLOC; } - o->internal = ctx; + o->priv = ctx; ctx->samplerate = 0; ctx->num_samples = 0; @@ -104,7 +104,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p *out = NULL; if (!o || !o->sdi) return SR_ERR_ARG; - ctx = o->internal; + ctx = o->priv; switch (packet->type) { case SR_DF_META: @@ -143,9 +143,9 @@ static int cleanup(struct sr_output *o) if (!o || !o->sdi) return SR_ERR_ARG; - ctx = o->internal; + ctx = o->priv; g_free(ctx); - o->internal = NULL; + o->priv = NULL; return SR_OK; } diff --git a/src/output/vcd.c b/src/output/vcd.c index 479f331c..9d5ca880 100644 --- a/src/output/vcd.c +++ b/src/output/vcd.c @@ -66,7 +66,7 @@ static int init(struct sr_output *o, GHashTable *options) } ctx = g_malloc0(sizeof(struct context)); - o->internal = ctx; + o->priv = ctx; ctx->num_enabled_channels = num_enabled_channels; ctx->channel_index = g_malloc(sizeof(int) * ctx->num_enabled_channels); @@ -94,7 +94,7 @@ static GString *gen_header(const struct sr_output *o) int num_channels, i; char *samplerate_s, *frequency_s, *timestamp; - ctx = o->internal; + ctx = o->priv; header = g_string_sized_new(512); num_channels = g_slist_length(o->sdi->channels); @@ -170,9 +170,9 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p gboolean timestamp_written; *out = NULL; - if (!o || !o->internal) + if (!o || !o->priv) return SR_ERR_BUG; - ctx = o->internal; + ctx = o->priv; switch (packet->type) { case SR_DF_META: @@ -251,10 +251,10 @@ static int cleanup(struct sr_output *o) { struct context *ctx; - if (!o || !o->internal) + if (!o || !o->priv) return SR_ERR_ARG; - ctx = o->internal; + ctx = o->priv; g_free(ctx->prevsample); g_free(ctx->channel_index); g_free(ctx);