This makes it consistent with other libsigrok fields used for this purpose.
* 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. */
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();
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;
}
}
ctx = g_malloc0(sizeof(struct context));
- o->internal = ctx;
+ o->priv = ctx;
ctx->trigger = -1;
ctx->samples_per_line = spl;
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) {
*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) {
if (!o)
return SR_ERR_ARG;
- if (!(ctx = o->internal))
+ if (!(ctx = o->priv))
return SR_OK;
g_free(ctx->channel_index);
g_string_free(ctx->lines[i], TRUE);
g_free(ctx->lines);
g_free(ctx);
- o->internal = NULL;
+ o->priv = NULL;
return SR_OK;
}
}
ctx = g_malloc0(sizeof(struct context));
- o->internal = ctx;
+ o->priv = ctx;
ctx->trigger = -1;
ctx->samples_per_line = spl;
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) {
*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) {
if (!o)
return SR_ERR_ARG;
- if (!(ctx = o->internal))
+ if (!(ctx = o->priv))
return SR_OK;
g_free(ctx->channel_index);
g_string_free(ctx->lines[i], TRUE);
g_free(ctx->lines);
g_free(ctx);
- o->internal = NULL;
+ o->priv = NULL;
return SR_OK;
}
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;
*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) {
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;
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. */
int num_channels, i;
char *samplerate_s;
- ctx = o->internal;
+ ctx = o->priv;
header = g_string_sized_new(512);
/* Some metadata */
*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) {
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;
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;
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) {
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;
{
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);
}
ctx = g_malloc0(sizeof(struct context));
- o->internal = ctx;
+ o->priv = ctx;
ctx->trigger = -1;
ctx->samples_per_line = spl;
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) {
*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) {
if (!o)
return SR_ERR_ARG;
- if (!(ctx = o->internal))
+ if (!(ctx = o->priv))
return SR_OK;
g_free(ctx->channel_index);
g_string_free(ctx->lines[i], TRUE);
g_free(ctx->lines);
g_free(ctx);
- o->internal = NULL;
+ o->priv = NULL;
return SR_OK;
}
sr_err("%s: ctx malloc failed", __func__);
return SR_ERR_MALLOC;
}
- o->internal = ctx;
+ o->priv = ctx;
ctx->samplerate = 0;
ctx->num_samples = 0;
*out = NULL;
if (!o || !o->sdi)
return SR_ERR_ARG;
- ctx = o->internal;
+ ctx = o->priv;
switch (packet->type) {
case SR_DF_META:
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;
}
}
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);
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);
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:
{
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);