]> sigrok.org Git - libsigrokdecode.git/commitdiff
runtc: PD option value is a GVariant, not string.
authorBert Vermeulen <redacted>
Thu, 26 Jun 2014 17:56:02 +0000 (19:56 +0200)
committerBert Vermeulen <redacted>
Thu, 26 Jun 2014 18:02:44 +0000 (20:02 +0200)
This is still broken: it needs to properly check the expected type of
the option, not just blindly assume G_VARIANT_TYPE_STRING.

tests/runtc.c

index e376070bb1f7038655816cee075dd93007b74760..ab5513958606aa35a0d33e720d740c82a589f1ee 100644 (file)
@@ -48,7 +48,7 @@ struct channel {
 
 struct option {
        char *key;
-       char *value;
+       GVariant *value;
 };
 
 struct pd {
@@ -736,7 +736,8 @@ int main(int argc, char **argv)
                        } else {
                                option = malloc(sizeof(struct option));
                                option->key = g_strdup(kv[0]);
-                               option->value = g_strdup(kv[1]);
+                               option->value = g_variant_new_string(kv[1]);
+                g_variant_ref_sink(option->value);
                                /* Apply to last PD. */
                                pd->options = g_slist_append(pd->options, option);
                        }