aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-05-09 19:32:29 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-05-09 19:32:29 +0200
commitdc84002a8256feb1cc7f0fb70bdbfc998deeba4a (patch)
treef46e8b826fda198b54138ae09aecbd2b1bbce93b
parent62775ec4b34bd2a1b5e4c60aa40ba67bd979069a (diff)
downloadbusybox-w32-dc84002a8256feb1cc7f0fb70bdbfc998deeba4a.tar.gz
busybox-w32-dc84002a8256feb1cc7f0fb70bdbfc998deeba4a.tar.bz2
busybox-w32-dc84002a8256feb1cc7f0fb70bdbfc998deeba4a.zip
nslookup: code shrink
function old new delta send_queries 725 723 -2 nslookup_main 822 820 -2 add_query 89 86 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-7) Total: -7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/nslookup.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 24eae4010..249083e24 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -589,6 +589,7 @@ static int RESOLVFUNC res_mkquery(int op, const char *dname, int class, int type
589 if (l>253 || buflen<n || op>15u || class>255u || type>255u) 589 if (l>253 || buflen<n || op>15u || class>255u || type>255u)
590 return -1; 590 return -1;
591 591
592//TODO: why do we even have the q[] array? Use buf[] directly!
592 /* Construct query template - ID will be filled later */ 593 /* Construct query template - ID will be filled later */
593 memset(q, 0, n); 594 memset(q, 0, n);
594 q[2] = op*8 + 1; 595 q[2] = op*8 + 1;
@@ -637,7 +638,12 @@ struct query {
637 unsigned qlen; 638 unsigned qlen;
638// unsigned latency; 639// unsigned latency;
639// uint8_t rcode; 640// uint8_t rcode;
640 unsigned char query[512]; 641 /* res_mkquery() balks on names > 253 chars.
642 * The formed query is 253+18 chars at max.
643 * Real hostnames are nowhere near that long anyway.
644 * Use of power-of-2 size means smaller code.
645 */
646 unsigned char query[512 - sizeof(int) - sizeof(char*)];
641// unsigned char reply[512]; 647// unsigned char reply[512];
642}; 648};
643 649