]> sigrok.org Git - libserialport.git/commitdiff
Fix use of variable length local array in await_events example.
authorMartin Ling <redacted>
Fri, 24 Jan 2020 06:24:59 +0000 (06:24 +0000)
committerUwe Hermann <redacted>
Sun, 26 Jan 2020 20:11:46 +0000 (21:11 +0100)
This prevented building with MSVC.

examples/await_events.c

index 133d899376fb08e9ee30e7d8dc69e020b7172b3f..672d531c2d4fc5a9383ea5bc9c7d193887f20190 100644 (file)
@@ -20,7 +20,9 @@ int main(int argc, char **argv)
        char **port_names = argv + 1;
 
        /* The ports we will use. */
-       struct sp_port *ports[num_ports];
+       struct sp_port **ports = malloc(num_ports * sizeof(struct sp_port *));
+       if (!ports)
+               abort();
 
        /* The set of events we will wait for. */
        struct sp_event_set *event_set;