]> sigrok.org Git - sigrok-cli.git/commitdiff
parsers: use common library code to rename sigrok channels
authorGerhard Sittig <redacted>
Tue, 16 Aug 2022 20:14:23 +0000 (22:14 +0200)
committerGerhard Sittig <redacted>
Tue, 16 Aug 2022 20:14:23 +0000 (22:14 +0200)
Drop an open coded g_free() and g_strdup() sequence which accesses
internal details of a sigrok channel. Use the sr_dev_channel_name_set()
library routine instead.

parsers.c

index c1ab9bdabf5a2bf728c3f4477d5e170e4186605a..b74d74fe98792ac314094be4bf927b1e11b51fb3 100644 (file)
--- a/parsers.c
+++ b/parsers.c
@@ -139,8 +139,7 @@ range_fail:
                        }
                        if (names[1]) {
                                /* Rename channel. */
                        }
                        if (names[1]) {
                                /* Rename channel. */
-                               g_free(ch->name);
-                               ch->name = g_strdup(names[1]);
+                               sr_dev_channel_name_set(ch, names[1]);
                        }
                        channellist = g_slist_append(channellist, ch);
 
                        }
                        channellist = g_slist_append(channellist, ch);