aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-10-12 20:42:58 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2016-10-12 20:42:58 +0200
commit57727d478db55b25bdc33bb9067915b659605ae6 (patch)
tree8309c16618966df2c5c3b97bf1120031146257ce
parent26d88d6bbda628f0005115bbe0f85722db267793 (diff)
downloadbusybox-w32-57727d478db55b25bdc33bb9067915b659605ae6.tar.gz
busybox-w32-57727d478db55b25bdc33bb9067915b659605ae6.tar.bz2
busybox-w32-57727d478db55b25bdc33bb9067915b659605ae6.zip
telnet: code shrink
put_iac2(w,c) is mostly used with constants, fold them into one arg function old new delta put_iac2_merged - 46 +46 telnet_main 1603 1583 -20 con_escape 285 257 -28 put_iac2 50 - -50 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/2 up/down: 46/-98) Total: -52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/telnet.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/networking/telnet.c b/networking/telnet.c
index d2daf5c8c..1a6986b94 100644
--- a/networking/telnet.c
+++ b/networking/telnet.c
@@ -311,15 +311,16 @@ static void put_iac(int c)
311 G.iacbuf[G.iaclen++] = c; 311 G.iacbuf[G.iaclen++] = c;
312} 312}
313 313
314static void put_iac2(byte wwdd, byte c) 314static void put_iac2_merged(unsigned wwdd_and_c)
315{ 315{
316 if (G.iaclen + 3 > IACBUFSIZE) 316 if (G.iaclen + 3 > IACBUFSIZE)
317 iac_flush(); 317 iac_flush();
318 318
319 put_iac(IAC); 319 put_iac(IAC);
320 put_iac(wwdd); 320 put_iac(wwdd_and_c >> 8);
321 put_iac(c); 321 put_iac(wwdd_and_c & 0xff);
322} 322}
323#define put_iac2(wwdd,c) put_iac2_merged(((wwdd)<<8) + (c))
323 324
324#if ENABLE_FEATURE_TELNET_TTYPE 325#if ENABLE_FEATURE_TELNET_TTYPE
325static void put_iac_subopt(byte c, char *str) 326static void put_iac_subopt(byte c, char *str)