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).
This commit is contained in:
cinap_lenrek 2015-03-11 18:09:48 +01:00
parent 9babf6a347
commit 6eba362810

View file

@ -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;