code cleanup

This commit is contained in:
Bjorn Andersson 2007-02-10 22:52:36 +00:00
parent 757f59e350
commit eb082ac9ce

View file

@ -193,22 +193,22 @@ dns_build_hostname(char *buf, size_t buflen,
const char *data, const size_t datalen, const char *data, const size_t datalen,
const char *topdomain) const char *topdomain)
{ {
int consumed;
int avail; int avail;
int written;
int encoded;
char *b; char *b;
avail = MIN(0xFF, buflen) - strlen(topdomain) - 2; avail = MIN(0xFF, buflen) - strlen(topdomain) - 2;
memset(buf, 0, buflen); memset(buf, 0, buflen);
b = buf; b = buf;
written = encode_data(data, datalen, avail, b);
encoded = strlen(buf); consumed = encode_data(data, datalen, avail, b);
b += encoded;
if (*b != '.') { b += strlen(buf);
if (*b != '.')
*b++ = '.'; *b++ = '.';
}
strncpy(b, topdomain, strlen(topdomain)+1); strncpy(b, topdomain, strlen(topdomain)+1);
return written; return consumed;
} }