X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Foutput%2Fols.c;h=5266c27c77526ecdcf48381b43cfae9148c91b5f;hb=HEAD;hp=8c9cca8d33789954849d04e73129601e813c5f7c;hpb=a755b0e122105d934c4e7b97435420eda6df6e8e;p=libsigrok.git diff --git a/src/output/ols.c b/src/output/ols.c index 8c9cca8d..2129658a 100644 --- a/src/output/ols.c +++ b/src/output/ols.c @@ -15,8 +15,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ /* @@ -25,10 +24,11 @@ * https://github.com/jawi/ols/wiki/OLS-data-file-format */ +#include #include #include #include -#include "libsigrok.h" +#include #include "libsigrok-internal.h" #define LOG_PREFIX "output/ols" @@ -44,12 +44,8 @@ static int init(struct sr_output *o, GHashTable *options) (void)options; - if (!(ctx = g_try_malloc(sizeof(struct context)))) { - sr_err("%s: ctx malloc failed", __func__); - return SR_ERR_MALLOC; - } - o->internal = ctx; - + ctx = g_malloc0(sizeof(struct context)); + o->priv = ctx; ctx->samplerate = 0; ctx->num_samples = 0; @@ -104,7 +100,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 +139,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; } @@ -153,7 +149,9 @@ static int cleanup(struct sr_output *o) SR_PRIV struct sr_output_module output_ols = { .id = "ols", .name = "OLS", - .desc = "OpenBench Logic Sniffer", + .desc = "OpenBench Logic Sniffer data", + .exts = (const char*[]){"ols", NULL}, + .flags = 0, .options = NULL, .init = init, .receive = receive,