[PATCH 3/4] utils: skip comment lines when parsing devices.txt

Andre Heider a.heider at gmail.com
Wed Jan 18 05:24:37 PST 2023


Just a small optimization, skip the line early if it starts with a #.

Signed-off-by: Andre Heider <a.heider at gmail.com>
---
 iwinfo_utils.c | 3 +++
 1 file changed, 3 insertions(+)

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[^\"]\"",
-- 
2.39.0




More information about the openwrt-devel mailing list