Use a list for device->boot_options
[petitboot] / ui / test / pb-test.c
index e8004981b3fecf32e62e6a79d0a83d08ced6a77f..5f021ff7e73d73f6455c8855f5500a40f31a34ea 100644 (file)
@@ -5,7 +5,7 @@
 
 static int print_device_add(struct device *device)
 {
-       int i;
+       struct boot_option *opt;
 
        printf("new device:\n");
        printf("\tid:   %s\n", device->id);
@@ -13,9 +13,8 @@ static int print_device_add(struct device *device)
        printf("\tdesc: %s\n", device->description);
        printf("\ticon: %s\n", device->icon_file);
 
-       printf("\t%d boot options:\n", device->n_options);
-       for (i = 0; i < device->n_options; i++) {
-               struct boot_option *opt = &device->options[i];
+       printf("\tboot options:\n");
+       list_for_each_entry(&device->boot_options, opt, list) {
                printf("\t\tid:   %s\n", opt->id);
                printf("\t\tname: %s\n", opt->name);
                printf("\t\tdesc: %s\n", opt->description);