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;
|
ilen = f->prec;
|
||||||
f->prec = 0;
|
f->prec = 0;
|
||||||
f->flags &= ~FmtPrec;
|
f->flags &= ~FmtPrec;
|
||||||
switch(f->r){
|
len = 2*ilen + 1;
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(len > sizeof(obuf)){
|
if(len > sizeof(obuf)){
|
||||||
buf = malloc(len);
|
buf = malloc(len);
|
||||||
if(buf == nil)
|
if(buf == nil)
|
||||||
|
@ -1736,20 +1723,7 @@ sencodefmt(Fmt *f)
|
||||||
|
|
||||||
/* convert */
|
/* convert */
|
||||||
out = buf;
|
out = buf;
|
||||||
switch(f->r){
|
rv = enc16(out, len, b, ilen);
|
||||||
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;
|
|
||||||
}
|
|
||||||
if(rv < 0)
|
if(rv < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue