]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/hp-3457a/api.c
use common channel group allocation/release code
[libsigrok.git] / src / hardware / hp-3457a / api.c
index 4cfc2d758b54e79625609d408ef0f506d028a5b7..9f006df5600f43889b8a58bfde775c079c49c14d 100644 (file)
@@ -52,12 +52,9 @@ static int create_front_channel(struct sr_dev_inst *sdi, int chan_idx)
                                 TRUE, "Front");
        channel->priv = chanc;
 
-       front = g_malloc0(sizeof(*front));
-       front->name = g_strdup("Front");
+       front = sr_channel_group_new(sdi, "Front", NULL);
        front->channels = g_slist_append(front->channels, channel);
 
-       sdi->channel_groups = g_slist_append(sdi->channel_groups, front);
-
        return chan_idx;
 }
 
@@ -74,10 +71,7 @@ static int create_rear_channels(struct sr_dev_inst *sdi, int chan_idx,
        if (!card)
                return chan_idx;
 
-       group = g_malloc0(sizeof(*group));
-       group->priv = NULL;
-       group->name = g_strdup(card->cg_name);
-       sdi->channel_groups = g_slist_append(sdi->channel_groups, group);
+       group = sr_channel_group_new(sdi, card->cg_name, NULL);
 
        for (i = 0; i < card->num_channels; i++) {