telnet: code shrink
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 12 Oct 2016 18:42:58 +0000 (20:42 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 12 Oct 2016 18:42:58 +0000 (20:42 +0200)
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>
networking/telnet.c

index d2daf5c8ce925e38ba3ddba2307873e8cfcec7e7..1a6986b9483724360008753904b75ca022ac5d51 100644 (file)
@@ -311,15 +311,16 @@ static void put_iac(int c)
        G.iacbuf[G.iaclen++] = c;
 }
 
-static void put_iac2(byte wwdd, byte c)
+static void put_iac2_merged(unsigned wwdd_and_c)
 {
        if (G.iaclen + 3 > IACBUFSIZE)
                iac_flush();
 
        put_iac(IAC);
-       put_iac(wwdd);
-       put_iac(c);
+       put_iac(wwdd_and_c >> 8);
+       put_iac(wwdd_and_c & 0xff);
 }
+#define put_iac2(wwdd,c) put_iac2_merged(((wwdd)<<8) + (c))
 
 #if ENABLE_FEATURE_TELNET_TTYPE
 static void put_iac_subopt(byte c, char *str)