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:
parent
9babf6a347
commit
6eba362810
1 changed files with 2 additions and 28 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue