Line comments with '#' mark at the beginning are compared to
on every 'if' statement although those lines could be notified
as comments at the early stage.
It better skips them, hence we save a few cycles while parsing.

These tests are passed,
     # comment type 1
#      comment type 2
# comment type 3
#comment type 4

Signed-off-by: Leesoo Ahn <[email protected]>
---
 networking/nslookup.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/networking/nslookup.c b/networking/nslookup.c
index c43e60558..c94391f01 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -707,6 +707,11 @@ static void parse_resolvconf(void)
                        p = strtok(line, " \t\n");
                        if (!p)
                                continue;
+
+                       /* line comment? */
+                       if (*p == '#')
+                               continue; /* yes */
+
                        dbg("resolv_key:'%s'\n", p);
                        arg = strtok(NULL, "\n");
                        dbg("resolv_arg:'%s'\n", arg);
-- 
2.24.1

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to