summaryrefslogtreecommitdiff
path: root/networking/udhcp/script.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-12-08 22:56:18 +0000
committerDenis Vlasenko2008-12-08 22:56:18 +0000
commitefb545b9bdd3934dcdbf9bc0890a42081b330049 (patch)
tree4dc9212e49a5dae9890bd324bcc9bf4941e2321d /networking/udhcp/script.c
parentd1a84a2880073f6cc5e2f9f4e5f236cd110f01a0 (diff)
downloadbusybox-efb545b9bdd3934dcdbf9bc0890a42081b330049.zip
busybox-efb545b9bdd3934dcdbf9bc0890a42081b330049.tar.gz
optimize 16- and 32-bit moves
function old new delta udhcpd_main 1239 1257 +18 udhcp_add_simple_option 93 92 -1 buffer_read_le_u32 19 18 -1 unpack_gz_stream_with_info 526 520 -6 dnsd_main 1470 1463 -7 udhcp_run_script 1208 1186 -22 send_ACK 255 229 -26 arping_main 1661 1623 -38 send_offer 470 428 -42 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/8 up/down: 18/-143) Total: -125 bytes
Diffstat (limited to 'networking/udhcp/script.c')
-rw-r--r--networking/udhcp/script.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/networking/udhcp/script.c b/networking/udhcp/script.c
index 8dff9b7..4ae17fb 100644
--- a/networking/udhcp/script.c
+++ b/networking/udhcp/script.c
@@ -90,19 +90,19 @@ static char *alloc_fill_opts(uint8_t *option, const struct dhcp_option *type_p,
dest += sprintf(dest, "%u", *option);
break;
case OPTION_U16:
- memcpy(&val_u16, option, 2);
+ move_from_unaligned16(val_u16, option);
dest += sprintf(dest, "%u", ntohs(val_u16));
break;
case OPTION_S16:
- memcpy(&val_s16, option, 2);
+ move_from_unaligned16(val_s16, option);
dest += sprintf(dest, "%d", ntohs(val_s16));
break;
case OPTION_U32:
- memcpy(&val_u32, option, 4);
+ move_from_unaligned32(val_u32, option);
dest += sprintf(dest, "%lu", (unsigned long) ntohl(val_u32));
break;
case OPTION_S32:
- memcpy(&val_s32, option, 4);
+ move_from_unaligned32(val_s32, option);
dest += sprintf(dest, "%ld", (long) ntohl(val_s32));
break;
case OPTION_STRING:
@@ -183,7 +183,7 @@ static char **fill_envp(struct dhcpMessage *packet)
/* Fill in a subnet bits option for things like /24 */
if (dhcp_options[i].code == DHCP_SUBNET) {
uint32_t subnet;
- memcpy(&subnet, temp, 4);
+ move_from_unaligned32(subnet, temp);
envp[j++] = xasprintf("mask=%d", mton(subnet));
}
next: