diff options
author | Andre Heider <a.heider@gmail.com> | 2023-01-18 14:24:37 +0100 |
---|---|---|
committer | Christian Marangi <ansuelsmth@gmail.com> | 2023-01-20 16:08:00 +0100 |
commit | c0fda7cf249008315a52093a81beae440b2ed005 (patch) | |
tree | be9848a20efe5e303a71d58a3db7baefdd5da918 | |
parent | dbc0ee7c57134f848726f7bbe7638ab10d8596e8 (diff) | |
download | iwinfo-c0fda7cf249008315a52093a81beae440b2ed005.tar.gz |
utils: skip comment lines when parsing devices.txt
Just a small optimization, skip the line early if it starts with a #.
Signed-off-by: Andre Heider <a.heider@gmail.com>
-rw-r--r-- | iwinfo_utils.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/iwinfo_utils.c b/iwinfo_utils.c index ecd1dff..d96cbb3 100644 --- a/iwinfo_utils.c +++ b/iwinfo_utils.c @@ -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[^\"]\"", |