summaryrefslogtreecommitdiff
path: root/sys/src/cmd
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-03-11 18:09:48 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2015-03-11 18:09:48 +0100
commit6eba362810c398e59727e8286b1e3f24178b6618 (patch)
tree61d9544c535879545fa222a8e939ae8d55c2c439 /sys/src/cmd
parent9babf6a347c71b01cdc8c057185083b96447af62 (diff)
ndb/dns: reduce sencodefmt() to not link in enc32()/enc64() encoders
the special sencodefmt() in ndb/dn.c is only used with %H format for hexadecimal printing for binary strings. removing the unused calls to enc32() and enc64() reduces the code size by arround 4K. (this is usefull for ndb/getip which gets linked into the kernel).
Diffstat (limited to 'sys/src/cmd')
-rw-r--r--sys/src/cmd/ndb/dn.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/sys/src/cmd/ndb/dn.c b/sys/src/cmd/ndb/dn.c
index 08b86369f..412acbe11 100644
--- a/sys/src/cmd/ndb/dn.c
+++ b/sys/src/cmd/ndb/dn.c
@@ -1713,20 +1713,7 @@ sencodefmt(Fmt *f)
ilen = f->prec;
f->prec = 0;
f->flags &= ~FmtPrec;
- switch(f->r){
- case '<':
- len = (8*ilen+4)/5 + 3;
- break;
- case '[':
- len = (8*ilen+5)/6 + 4;
- break;
- case 'H':
- len = 2*ilen + 1;
- break;
- default:
- goto error;
- }
-
+ len = 2*ilen + 1;
if(len > sizeof(obuf)){
buf = malloc(len);
if(buf == nil)
@@ -1736,20 +1723,7 @@ sencodefmt(Fmt *f)
/* convert */
out = buf;
- switch(f->r){
- case '<':
- rv = enc32(out, len, b, ilen);
- break;
- case '[':
- rv = enc64(out, len, b, ilen);
- break;
- case 'H':
- rv = enc16(out, len, b, ilen);
- break;
- default:
- rv = -1;
- break;
- }
+ rv = enc16(out, len, b, ilen);
if(rv < 0)
goto error;