aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2016-02-26 14:56:18 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2016-02-26 14:56:18 +0100
commit5bec08cebd559c906eb94b8b957afb9f0b8db338 (patch)
treed4165f1abe7d0dd568c8febd4b2aaa5c291e3650
parent5fa9fefddce56fab75b2e6c88c4516e2b21d2f5a (diff)
downloadbusybox-w32-5bec08cebd559c906eb94b8b957afb9f0b8db338.tar.gz
busybox-w32-5bec08cebd559c906eb94b8b957afb9f0b8db338.tar.bz2
busybox-w32-5bec08cebd559c906eb94b8b957afb9f0b8db338.zip
udhcp: trivial shrink
function old new delta dname_dec 337 332 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/domain_codec.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/networking/udhcp/domain_codec.c b/networking/udhcp/domain_codec.c
index c1325d8be..05cdf51e9 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)
42 */ 42 */
43 while (1) { 43 while (1) {
44 /* note: "return NULL" below are leak-safe since 44 /* note: "return NULL" below are leak-safe since
45 * dst isn't yet allocated */ 45 * dst isn't allocated yet */
46 const uint8_t *c; 46 const uint8_t *c;
47 unsigned crtpos, retpos, depth, len; 47 unsigned crtpos, retpos, depth, len;
48 48
@@ -95,9 +95,8 @@ char* FAST_FUNC dname_dec(const uint8_t *cstr, int clen, const char *pre)
95 if (!dst) { /* first pass? */ 95 if (!dst) { /* first pass? */
96 /* allocate dst buffer and copy pre */ 96 /* allocate dst buffer and copy pre */
97 unsigned plen = strlen(pre); 97 unsigned plen = strlen(pre);
98 ret = dst = xmalloc(plen + len); 98 ret = xmalloc(plen + len);
99 memcpy(dst, pre, plen); 99 dst = stpcpy(ret, pre);
100 dst += plen;
101 } else { 100 } else {
102 dst[len - 1] = '\0'; 101 dst[len - 1] = '\0';
103 break; 102 break;