diff options
author | Denys Vlasenko | 2016-02-26 14:56:18 +0100 |
---|---|---|
committer | Denys Vlasenko | 2016-02-26 14:56:18 +0100 |
commit | 5bec08cebd559c906eb94b8b957afb9f0b8db338 (patch) | |
tree | d4165f1abe7d0dd568c8febd4b2aaa5c291e3650 /networking | |
parent | 5fa9fefddce56fab75b2e6c88c4516e2b21d2f5a (diff) | |
download | busybox-5bec08cebd559c906eb94b8b957afb9f0b8db338.zip busybox-5bec08cebd559c906eb94b8b957afb9f0b8db338.tar.gz |
udhcp: trivial shrink
function old new delta
dname_dec 337 332 -5
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/udhcp/domain_codec.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/networking/udhcp/domain_codec.c b/networking/udhcp/domain_codec.c index c1325d8..05cdf51 100644 --- a/networking/udhcp/domain_codec.c +++ b/networking/udhcp/domain_codec.c @@ -42,7 +42,7 @@ char* FAST_FUNC dname_dec(const uint8_t *cstr, int clen, const char *pre) */ while (1) { /* note: "return NULL" below are leak-safe since - * dst isn't yet allocated */ + * dst isn't allocated yet */ const uint8_t *c; unsigned crtpos, retpos, depth, len; @@ -95,9 +95,8 @@ char* FAST_FUNC dname_dec(const uint8_t *cstr, int clen, const char *pre) if (!dst) { /* first pass? */ /* allocate dst buffer and copy pre */ unsigned plen = strlen(pre); - ret = dst = xmalloc(plen + len); - memcpy(dst, pre, plen); - dst += plen; + ret = xmalloc(plen + len); + dst = stpcpy(ret, pre); } else { dst[len - 1] = '\0'; break; |