output: Rename instance private storage pointer to priv.

This makes it consistent with other libsigrok fields used for this purpose.
This commit is contained in:
Bert Vermeulen 2014-07-28 15:56:17 +02:00
parent dddabe3705
commit d686c5ec46
10 changed files with 48 additions and 48 deletions

View File

@ -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. */

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);