utils: skip comment lines when parsing devices.txt
authorAndre Heider <a.heider@gmail.com>
Wed, 18 Jan 2023 13:24:37 +0000 (14:24 +0100)
committerChristian Marangi <ansuelsmth@gmail.com>
Fri, 20 Jan 2023 15:08:00 +0000 (16:08 +0100)
Just a small optimization, skip the line early if it starts with a #.

Signed-off-by: Andre Heider <a.heider@gmail.com>
iwinfo_utils.c

index ecd1dffb77ee0a812bcdeee2d5d0122cd6f2fb82..d96cbb345e68fb9b9a4d6edcc3067b5a192afd23 100644 (file)
@@ -280,6 +280,9 @@ struct iwinfo_hardware_entry * iwinfo_hardware(struct iwinfo_hardware_id *id)
 
        while (fgets(buf, sizeof(buf) - 1, db) != NULL)
        {
+               if (buf[0] == '#')
+                       continue;
+
                memset(&e, 0, sizeof(e));
 
                if (sscanf(buf, "%hx %hx %hx %hx %hd %hd \"%63[^\"]\" \"%63[^\"]\"",